-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
Should node support subcommands? #53483
Comments
I've voiced concerns about this various times in the past, perhaps most recently in this comment. Don't get me wrong, subcommands are great, and if we were to redesign Node.js from scratch we likely should use them. However, ... I have reason to believe that a significant number of users rely on the fact that More generally, accepting either a positional argument or a subcommand in the same location is an anti-pattern in my mind. We unfortunately already have The only semi-reasonable way I see is to fully deprecate |
why would that take years? |
We can doc-only deprecate the current behavior right now, and releasing that would take days to weeks. But actually moving We could take some pragmatic, not very elegant steps to avoid reaching end-of-life status, e.g., by still allowing |
I think, for example, that preventing #!/usr/bin/env node
... ) from working. |
This comment has been minimized.
This comment has been minimized.
I'm not aware of anything else that does this, but IMO this would be terribly confusing to users -- in many cases the quotes would be processed by the shell and wouldn't be seen by the program being run (i.e. |
This comment has been minimized.
This comment has been minimized.
why would adding subcommands break hashbang? I am not following |
Because if you have a file called #!/usr/bin/env node
... that has execute permissions and you run it, e.g.
it will end up running the equivalent of
|
I'm +1 on making this breaking change. I think the UX for cli flags are really bad that even I have some trouble understanding if feature X is working with feature Y. |
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-stale
|
What is the problem this feature will solve?
currently, node's cli interface is pretty simple and lean,
it mainly accepts flags that start with two dashes, or sometimes a single dash for some aliases.
additionally, many flags depend on each other or imply using another flag.
now that more and more flags are added to node, (and each new flag is heavily considered before adding to avoid options bloat), I propose we support a more complex cli interface with sub-commands.
this issue has come up before when adding
node --run
, and to avoid blocking that - the discussion was postponed, so I went ahead and opened this issue.If I recall, the main concern was
node run
ornode test
is a breaking change since it today runsnode run.js
ornode test.js
accordingly - that can be addressed with releasing this gradually as semver-major with a deprecation warning for a few versions prior to the actual changesome groups/clusters of commands that might fit using sub commands:
node --run
node --watch
,--watch-path
node --test
node --build-snapshot
What is the feature you are proposing to solve the problem?
N/A
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: