Skip to content

Conversation

@shadowspawn
Copy link
Collaborator

@shadowspawn shadowspawn commented Apr 2, 2020

Pull Request

Problem

The use of arguments.length to test for parameters in the get/set routines leads to misleading editor auto-generated help. This is a documentation problem for the author rather than a functional problem.

For example, Visual Studio Code displays extra parameters for any routine which has a call to arguments.length:

(method) Command.name(str?: string, ...args: any[]): string | Command

Solution

Replace uses of arguments.length with test of parameter against undefined. Now VSC displays:

(method) Command.name(str?: string): string | Command

Also:

  • tightened special case behaviour in alias for adding alias for executable subcommand
  • refactored usage to only calculate the default usage string when required

Copy link
Collaborator

@abetomo abetomo left a comment

Choose a reason for hiding this comment

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

LGTM!

@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Apr 3, 2020
@shadowspawn shadowspawn merged commit b59adfc into tj:develop Apr 3, 2020
@shadowspawn shadowspawn deleted the feature/elimimate-arguments branch April 3, 2020 06:00
@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Apr 25, 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

Successfully merging this pull request may close these issues.

2 participants