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

fix(usage): clean up usage declarations #2821

Closed
wants to merge 8 commits into from
Closed

fix(usage): clean up usage declarations #2821

wants to merge 8 commits into from

Conversation

@wraithgar
Copy link
Contributor

@wraithgar wraithgar commented Mar 4, 2021

Small refactor of commands to allow usage to be more programmatically
generated, leading us in the direction of more tighly coupling each
command to the params it accepts.

Needs #2772 to land first before this is really reviewable.

@wraithgar wraithgar requested a review from as a code owner Mar 4, 2021
@wraithgar wraithgar force-pushed the gar/usage branch 2 times, most recently from ac488cb to f9fd164 Mar 4, 2021
@wraithgar wraithgar force-pushed the gar/usage branch 3 times, most recently from cedb1e1 to 3018705 Mar 4, 2021
Copy link
Contributor

@isaacs isaacs left a comment

Found a few pretty small bugs. I like where this is going!

lib/access.js Outdated Show resolved Hide resolved
'npm access edit [<package>]'
)
/* istanbul ignore next - see test/lib/load-all-commands.js */
static get usage () {
Copy link
Contributor

@isaacs isaacs Mar 5, 2021

🎉🎉🎉 💖

lib/base-command.js Outdated Show resolved Hide resolved
'--package=<pkg>[@<version>] -- <cmd> [args...]',
'-c \'<cmd> [args...]\'',
'--package=foo -c \'<cmd> [args...]\'',
]
Copy link
Contributor

@isaacs isaacs Mar 5, 2021

Dropping the bit about running without --call or positional args to enter a subshell. Maybe could add something like:

  '(without -c or arguments to enter subshell)',

Or tack it onto the description?

Also the npx stuff is missing, but probably that should just be moved to bin/npx-cli.js anyway.

Copy link
Contributor Author

@wraithgar wraithgar Mar 6, 2021

This is usage, not the man page. This just shows the args you can use. Because it was free-form before it got a little muddied. If I ask for usage on command a, I don't really need to see how to use command b. If we want a "see also" we can talk about that but I really think that belongs in help

Copy link
Contributor Author

@wraithgar wraithgar Mar 6, 2021

Having each flag describe what it does is definitely the direction this is moving us towards. For now we are separating our man page from basic usage. Next iteration we can define args instead of calling this "usage"

Usage is something that is built up from components i.e. command name, aliases, command description, args and their descriptions, etc.

lib/init.js Outdated Show resolved Hide resolved
lib/completion.js Outdated Show resolved Hide resolved
@wraithgar wraithgar force-pushed the gar/usage branch 2 times, most recently from 56698e5 to cc2faa4 Mar 6, 2021
@wraithgar
Copy link
Contributor Author

@wraithgar wraithgar commented Mar 6, 2021

@isaacs I tweaked the output to make it a little more nicely for things that don't have a description. I think we should find a "good enough" line here and then bikeshed the next phase.

(I still need to make the tests pass for this change on Monday)

@wraithgar wraithgar force-pushed the gar/usage branch 2 times, most recently from a9b6c58 to ea57efd Mar 6, 2021
@isaacs isaacs self-requested a review Mar 9, 2021
isaacs
isaacs approved these changes Mar 9, 2021
wraithgar added 8 commits Mar 9, 2021
All output that anything wants to make now goes through
`npm.output()`.  This is an incremental change getting us
closer to where we want to be with testing.

PR-URL: #2795
Credit: @wraithgar
Close: #2795
Reviewed-by: @ruyadorno, @isaacs
Small refactor of commands to allow usage to be more programmatically
generated, leading us in the direction of more tighly coupling each
command to the params it accepts.

PR-URL: #2821
Credit: @wraithgar
Close: #2821
Reviewed-by: @isaacs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants