Skip to content

Bugfix help command #3706

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

Merged
merged 4 commits into from
Jun 30, 2017
Merged

Conversation

sudoarslan
Copy link
Contributor

Summary - Bug Fix
This PR fixes #3559

The code removes unsupported aliases from the output list of help command and also prints out the supported alias (if there is any) for the command in the same row. For clarification, please have a look at the command generate-lock-entry and upgrade-interactive in the output below, you should be able to see the alias of the commands in the same line.

Output with this fix

Usage: yarn [command] [flags]

  Options:

    -h, --help                          output usage information
    -V, --version                       output the version number
    --verbose                           output verbose messages on internal operations
    --offline                           trigger an error if any required dependencies are not available in local cache
    --prefer-offline                    use network only if dependencies are not available in local cache
    --strict-semver                     
    --json                              
    --ignore-scripts                    don't run lifecycle scripts
    --har                               save HAR output of network traffic
    --ignore-platform                   ignore platform checks
    --ignore-engines                    ignore engines check
    --ignore-optional                   ignore optional dependencies
    --force                             install and build packages even if they were built before, overwrite lockfile
    --skip-integrity-check              run install without checking if node_modules is installed
    --check-files                       install will verify file tree of packages for consistency
    --no-bin-links                      don't generate bin links when setting up packages
    --flat                              only allow one version of a package
    --prod, --production [prod]         
    --no-lockfile                       don't read or generate a lockfile
    --pure-lockfile                     don't generate a lockfile
    --frozen-lockfile                   don't generate a lockfile and fail if an update is needed
    --link-duplicates                   create hardlinks to the repeated modules in node_modules
    --global-folder <path>              specify a custom folder to store global packages
    --modules-folder <path>             rather than installing modules into the node_modules folder relative to the cwd, output them here
    --cache-folder <path>               specify a custom folder to store the yarn cache
    --mutex <type>[:specifier]          use a mutex to ensure only one yarn instance is executing
    --emoji                             enable emoji in output
    -s, --silent                        skip Yarn console logs, other types of logs (script output) will be printed
    --proxy <host>                      
    --https-proxy <host>                
    --no-progress                       disable progress bar
    --network-concurrency <number>      maximum number of concurrent network requests
    --network-timeout <milliseconds>    TCP timeout for network requests
    --non-interactive                   do not show interactive prompts
    --scripts-prepend-node-path [bool]  prepend the node executable dir to the PATH in scripts

  Commands:

    - access
    - add
    - bin
    - cache
    - check
    - clean
    - config
    - create
    - exec
    - generate-lock-entry  alias: generateLockEntry
    - global
    - help
    - import
    - info
    - init
    - install
    - licenses
    - link
    - list
    - login
    - logout
    - outdated
    - owner
    - pack
    - publish
    - remove
    - run
    - tag
    - team
    - unlink
    - upgrade
    - upgrade-interactive  alias: upgradeInteractive
    - version
    - versions
    - why
    - workspace

  Run `yarn help COMMAND` for more information on specific commands.
  Visit https://yarnpkg.com/en/docs/cli/ to learn more about Yarn.

@@ -41,11 +43,14 @@ export function run(config: Config, reporter: Reporter, commander: Object, args:
const getDocsLink = name => `${constants.YARN_DOCS}${name || ''}`;
console.log(' Commands:\n');
for (const name of Object.keys(commands).sort(sortAlpha)) {
if (commands[name].useless) {
if (commands[name].useless || unsupportedAliases[name] || Object.values(aliases).includes(name)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure the Object.values().includes() construct will work on Node 4 :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I think the proper support for Array.prototype.includes came with Node 6. I will update the PR.


console.log(` - ${hyphenate(name)}`);
if (aliases[name]) {
console.log(` - ${hyphenate(name)} alias: ${aliases[name]}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just print - {name} / {alias1} / {alias2} / ... to be less verbose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, that will get the job done and would look cleaner as well. I will update the PR accordingly.

@voxsim
Copy link
Contributor

voxsim commented Jun 23, 2017

@arcanis and @arslanarshad31 I think we should get rid of every unsupported-alias and remove from the code and from tests as well, we discussed here and we agree, what do you think? Maybe we can do in this pull request if you are ok with that :)

@arcanis
Copy link
Member

arcanis commented Jun 29, 2017

@voxsim I'd be ok with that - @arslanarshad31 what do you think? Would you have time to do it?

@bestander
Copy link
Member

Ok, let's merge this as it is obviously an improvement over current situation.
But let's follow up with the removal.

@bestander bestander merged commit 6d145c3 into yarnpkg:master Jun 30, 2017
@sudoarslan
Copy link
Contributor Author

@voxsim @arcanis I think it should be fine to get rid of the unsupported aliases, I don't see them providing a very significant functionality as well and issues created because of them only slow down the development process.
Also, yes I can open a new PR in the coming days to nuke these unsupported aliases.

@bestander
Copy link
Member

bestander commented Jul 7, 2017 via email

@sudoarslan sudoarslan deleted the bugfix_help_command branch July 23, 2017 07:21
@pichouk pichouk mentioned this pull request Jul 26, 2017
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

Successfully merging this pull request may close these issues.

A mistake command 'isntall' in the help of yarn
4 participants