diff options
author | Gar <gar+gh@danger.computer> | 2021-03-04 07:26:33 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-03-09 22:10:06 +0300 |
commit | 9fe0df5b5d7606e5841288d9931be6c04767c9ca (patch) | |
tree | 50b916523fe4a5ebab6010b137cc931cc2a9ce70 /lib/root.js | |
parent | 85a8694dd9b4a924a474ba75261914511a216868 (diff) |
fix(usage): clean up usage declarations
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: https://github.com/npm/cli/pull/2821
Credit: @wraithgar
Close: #2821
Reviewed-by: @isaacs
Diffstat (limited to 'lib/root.js')
-rw-r--r-- | lib/root.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/root.js b/lib/root.js index 7c3fa2bbb..1fe82c6fa 100644 --- a/lib/root.js +++ b/lib/root.js @@ -1,13 +1,13 @@ -const usageUtil = require('./utils/usage.js') - -class Root { - constructor (npm) { - this.npm = npm +const BaseCommand = require('./base-command.js') +class Root extends BaseCommand { + /* istanbul ignore next - see test/lib/load-all-commands.js */ + static get name () { + return 'root' } /* istanbul ignore next - see test/lib/load-all-commands.js */ - get usage () { - return usageUtil('root', 'npm root [-g]') + static get usage () { + return ['[-g]'] } exec (args, cb) { |