Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deno help [subcommand] option as it is redundant due to --help and -h #4827

Closed
David-Else opened this issue Apr 20, 2020 · 11 comments
Closed

Comments

@David-Else
Copy link

David-Else commented Apr 20, 2020

EDIT (changed title and add this summary):
deno help [subcommand] is redundant, there should only be deno [subcommand] --help or deno [subcommand] -h

- h = help
--help = help with more detail
deno help [subcommand] is redundant and causes confusion

-- original report

deno help fmt - provides summary:

deno-fmt 
Auto-format JavaScript/TypeScript source code.
  deno fmt
  deno fmt myfile1.ts myfile2.ts
  deno fmt --check

Format stdin and write to stdout:
  cat file.ts | deno fmt -

USAGE:
    deno fmt [OPTIONS] [files]...

OPTIONS:
        --check                    Check if the source files are formatted.
    -h, --help                     Prints help information
    -L, --log-level <log-level>    Set log level [possible values: debug, info]
    -q, --quiet                    Suppress diagnostic output

ARGS:
    <files>...  

deno fmt --help - provides the same summary with different formatting:

deno-fmt 
Auto-format JavaScript/TypeScript source code.
  deno fmt
  deno fmt myfile1.ts myfile2.ts
  deno fmt --check

Format stdin and write to stdout:
  cat file.ts | deno fmt -

USAGE:
    deno fmt [OPTIONS] [files]...

OPTIONS:
        --check                    
            Check if the source files are formatted.

    -h, --help                     
            Prints help information

    -L, --log-level <log-level>    
            Set log level [possible values: debug, info]

    -q, --quiet                    
            Suppress diagnostic output
            By default, subcommands print human-readable diagnostic messages to stderr.
            If the flag is set, restrict these messages to errors.

ARGS:
    <files>... 

deno help test - provides summary:

deno-test 
Run tests using Deno's built-in test runner.

Evaluate the given modules, run all tests declared with 'Deno.test()' and
report results to standard output:
  deno test src/fetch_test.ts src/signal_test.ts

Directory arguments are expanded to all contained files matching the glob
{*_,}test.{js,ts,jsx,tsx}:
  deno test src/

USAGE:
    deno test [OPTIONS] [files]...

OPTIONS:
    -A, --allow-all                    Allow all permissions
        --allow-env                    Allow environment access
        --allow-hrtime                 Allow high resolution time measurement
        --allow-net=<allow-net>        Allow network access
        --allow-plugin                 Allow loading plugins
        --allow-read=<allow-read>      Allow file system read access
        --allow-run                    Allow running subprocesses
        --allow-write=<allow-write>    Allow file system write access
        --allow-none                   Don't return error code if no test files are found
        --cached-only                  Require that remote dependencies are already cached
        --cert <FILE>                  Load certificate authority from PEM encoded file
    -c, --config <FILE>                Load tsconfig.json configuration file
        --failfast                     Stop on first error
        --filter <filter>              A pattern to filter the tests to run by
    -h, --help                         Prints help information
        --importmap <FILE>             Load import map file
        --inspect=<HOST:PORT>          activate inspector on host:port (default: 127.0.0.1:9229)
        --inspect-brk=<HOST:PORT>      activate inspector on host:port and break at start of user script
        --lock <FILE>                  Check the specified lock file
        --lock-write                   Write lock file. Use with --lock.
    -L, --log-level <log-level>        Set log level [possible values: debug, info]
        --no-remote                    Do not resolve remote modules
    -q, --quiet                        Suppress diagnostic output
    -r, --reload=<CACHE_BLACKLIST>     Reload source code cache (recompile TypeScript)
        --seed <NUMBER>                Seed Math.random()
        --v8-flags=<v8-flags>          Set V8 command line options. For help: --v8-flags=--help

ARGS:
    <files>...    List of file names to run

deno test --help - provides summary with much additional information (for example -r):

deno-test 
Run tests using Deno's built-in test runner.

Evaluate the given modules, run all tests declared with 'Deno.test()' and
report results to standard output:
  deno test src/fetch_test.ts src/signal_test.ts

Directory arguments are expanded to all contained files matching the glob
{*_,}test.{js,ts,jsx,tsx}:
  deno test src/

USAGE:
    deno test [OPTIONS] [files]...

OPTIONS:
    -A, --allow-all                    
            Allow all permissions

        --allow-env                    
            Allow environment access

        --allow-hrtime                 
            Allow high resolution time measurement

        --allow-net=<allow-net>        
            Allow network access

        --allow-plugin                 
            Allow loading plugins

        --allow-read=<allow-read>      
            Allow file system read access

        --allow-run                    
            Allow running subprocesses

        --allow-write=<allow-write>    
            Allow file system write access

        --allow-none                   
            Don't return error code if no test files are found

        --cached-only                  
            Require that remote dependencies are already cached

        --cert <FILE>                  
            Load certificate authority from PEM encoded file

    -c, --config <FILE>                
            Load tsconfig.json configuration file

        --failfast                     
            Stop on first error

        --filter <filter>              
            A pattern to filter the tests to run by

    -h, --help                         
            Prints help information

        --importmap <FILE>             
            Load import map file
            Docs: https://deno.land/std/manual.md#import-maps
            Specification: https://wicg.github.io/import-maps/
            Examples: https://github.com/WICG/import-maps#the-import-map
        --inspect=<HOST:PORT>          
            activate inspector on host:port (default: 127.0.0.1:9229)

        --inspect-brk=<HOST:PORT>      
            activate inspector on host:port and break at start of user script

        --lock <FILE>                  
            Check the specified lock file

        --lock-write                   
            Write lock file. Use with --lock.

    -L, --log-level <log-level>        
            Set log level [possible values: debug, info]

        --no-remote                    
            Do not resolve remote modules

    -q, --quiet                        
            Suppress diagnostic output
            By default, subcommands print human-readable diagnostic messages to stderr.
            If the flag is set, restrict these messages to errors.
    -r, --reload=<CACHE_BLACKLIST>     
            Reload source code cache (recompile TypeScript)
            --reload
              Reload everything
            --reload=https://deno.land/std
              Reload only standard modules
            --reload=https://deno.land/std/fs/utils.ts,https://deno.land/std/fmt/colors.ts
              Reloads specific modules
        --seed <NUMBER>                
            Seed Math.random()

        --v8-flags=<v8-flags>          
            Set V8 command line options. For help: --v8-flags=--help


ARGS:
    <files>...    
            List of file names to run

I can't really work out how to use the help system properly, having two different ways of getting to the same help with no real way to say if I want a summary is very confusing. Have I missed something, maybe this is all explained somewhere and I am misunderstanding? Thanks.

@nayeemrmn
Copy link
Collaborator

There is -h which shows short help and --help which includes more detailed help, but will be the same for any given flag where a long_help() hasn't been written. The help subcommand has the same output as -h. That's how you can say if you want a summary or not.

deno fmt is not the same but with different formatting, look more carefully. It's just that deno test has some more long_help()s written for it.

This is clap's functionality.

@David-Else
Copy link
Author

@nayeemrmn So deno help [subcommand] is redundant, I should use deno [subcommand] --help or deno [subcommand] --h?

@nayeemrmn
Copy link
Collaborator

Yeah, though you meant -h instead of --h.

@David-Else
Copy link
Author

@nayeemrmn whoops, yes -h.

Why not remove the deno help [subcommand]? It just adds to confusion and seems pointless.

@nayeemrmn
Copy link
Collaborator

Why not remove the deno help [subcommand]? It just adds to confusion and seems pointless.

Cargo has it, there's probably a reason clap has it by default. This was no doubt considered for #3365 but purposefully left in. If you still want to argue against it please edit this issue, but 🤷‍♂️

@David-Else David-Else changed the title command line help --help confusing and not consistant Remove command line help option as it is redandant due to --help and -h Apr 20, 2020
@David-Else
Copy link
Author

@nayeemrmn I changed the issue, see if anyone else agrees with me,

@David-Else David-Else changed the title Remove command line help option as it is redandant due to --help and -h Remove deno help [subcommand] option as it is redandant due to --help and -h Apr 20, 2020
@David-Else David-Else changed the title Remove deno help [subcommand] option as it is redandant due to --help and -h Remove deno help [subcommand] option as it is redundant due to --help and -h Apr 20, 2020
@Caesar2011
Copy link
Contributor

You use help if you have no idea how to do something. In this case the command should just work. I do not see any possible mislead or misuse and would leave it as it is.

@David-Else
Copy link
Author

@Caesar2011 But you can use --help if you have no idea how to do something, that is the proper Unix/Linux way of doing things, why invent a new one and use both to confuse people?

cat --help // good
ls --help // good
cat help // No such file or directory
ls help // cannot access 'help': No such file or directory

@nayeemrmn
Copy link
Collaborator

@Caesar2011 But you can use --help if you have no idea how to do something, that is the proper Unix/Linux way of doing things, why invent a new one and use both to confuse people?

cat --help // good
ls --help // good
cat help // No such file or directory
ls help // cannot access 'help': No such file or directory

Those don't have subcommands :) Try git help. Programs with subcommands conventionally have a help subcommand. I can see how not having it could lead to confusion, on the other hand you still haven't explained why having it could do so. There is never unexpected behaviour.

@David-Else
Copy link
Author

@nayeemrmn You got me with the git example :) Maybe it is just me.

@ry
Copy link
Member

ry commented Apr 20, 2020

these are the defaults for the flag parsing crate we use

@ry ry closed this as completed Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants