Webpack-cli: Remove redundant args which serves the same purpose

Created on 25 Jan 2020  路  15Comments  路  Source: webpack/webpack-cli

Is your feature request related to a problem? Please describe.
As of now webpack-cli supports both a flag as well as a command to show up version and help information. This seems to be redundant. CLI toolings are shipped with just having flags for the purpose.

Describe the solution you'd like
Remove the help and version command.

Describe alternatives you've considered
N/A

Additional context
There has been a similar issue raised in the flow-typed repository

Discussion

Most helpful comment

Looking at git, the command help is used to show help on the usage of a specific command:

  • git --help (general usage)
  • git help pull (usage of the command pull)

They work differently. git is the first CLI comes to mind. Also npm works in the same way.

All 15 comments

Sounds fair, make a PR :)

I think both should be there as they arent conflicting any functionality and easier for beginners if we have both in place.

I think we should be more complaint with other CLIs. Look at git for example.

We are compliant, we have flags (like other CLIs), just commands are extra.

Looking at git, the command help is used to show help on the usage of a specific command:

  • git --help (general usage)
  • git help pull (usage of the command pull)

They work differently. git is the first CLI comes to mind. Also npm works in the same way.

Agree with the removal of redundant args.

Actually, after the discussion, this is not an actual removal. It's about changing the behaviour of existing commands. Did I miss something?

@ematipico I didn't get what you meant by "changing behavior".

If this aids in disscussion, here is the current behavior of help as a command/flag (for example) :

  • webpack help serve, webpack serve help, webpack serve --help, webpack --help serve
    All give same output (serve command help)
  • webpack --help, webpack help
    Both give same output (generic help)

webpack --help and webpack help should be different. Try the same using git or npm. I'd prefer to align to a stronger CLI such as git.

webpack help serve, webpack serve help, webpack serve --help , webpack --help serve
All give same output (serve command help)

Do you have the same behaviour using git?

Do you have the same behaviour using git?

No, in these CLIs help command is extension of help flag i.e. they perform same in certain conditions but command has extra functionalities.

Do you have the same behaviour using git?

Yes, except git merge help (i.e. help command passed later) is invalid.

I think we should we can safely remove help command for now as we are now targeting behavior matching to other CLIs like git. But later implement help as a full fledged command ( I will implement it if this seems alright to you ).

What about the version command?

We can focus on that later. Now there are still some important things to finish before v4. This can wait.

webpack help serve, webpack serve help, webpack serve --help , webpack --help serve
All give same output (serve command help)

webpack --help, webpack help
Both give same output (generic help)

Makes sense to remove help & version.

later, more important things on roadmap

I think we can close it. Supported:

  • webpack help and webpack --help
  • webpack version and webpack --version
  • webpack help and webpack --help (global output)
  • webpack version and webpack --version (global output)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sam-s4s picture sam-s4s  路  5Comments

snitin315 picture snitin315  路  5Comments

larkintuckerllc picture larkintuckerllc  路  5Comments

aleksandrlat picture aleksandrlat  路  3Comments

anyulled picture anyulled  路  4Comments