-
Notifications
You must be signed in to change notification settings - Fork 246
/
cli.js
executable file
·87 lines (70 loc) · 2.35 KB
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env node
const actions = require('./actions');
const PKG = require('./package.json');
const { program } = require('commander');
program
.version(PKG.version);
program
.command('ls')
.description('List all the registries')
.action(actions.onList);
program
.command('current')
.option('-u, --show-url', 'Show the registry URL instead of the name')
.description('Show current registry name or URL')
.action(actions.onCurrent);
program
.command('use <name>')
.description('Change current registry')
.action(actions.onUse);
program
.command('add <name> <url> [home]')
.description('Add custom registry')
.action(actions.onAdd);
program
.command('login <name> [base64]')
.option('-a, --always-auth', 'Set is always auth')
.option('-u, --username <username>', 'Your user name for this registry')
.option('-p, --password <password>', 'Your password for this registry')
.option('-e, --email <email>', 'Your email for this registry')
.description('Set authorize information for a custom registry with a base64 encoded string or username and password')
.action(actions.onLogin);
program
.command('set-hosted-repo <name> <repo>')
.description('Set hosted npm repository for a custom registry to publish package')
.action(actions.onSetRepository);
program
.command('set-scope <scopeName> <url>')
.description('Associating a scope with a registry')
.action(actions.onSetScope);
program
.command('del-scope <scopeName>')
.description('Remove a scope')
.action(actions.onDeleteScope);
program
.command('set <name>')
.requiredOption('-a,--attr <attr>', 'Set a custom registry attribute')
.requiredOption('-v,--value <value>', 'Set a custom registry value')
.description('Set a custom registry attribute')
.action(actions.onSetAttribute);
program
.command('rename <name> <newName>')
.description('Change custom registry name')
.action(actions.onRename);
program
.command('del <name>')
.description('Delete custom registry')
.action(actions.onDelete);
program
.command('home <name> [browser]')
.description('Open the homepage of registry with optional browser')
.action(actions.onHome);
program
.command('test [registry]')
.description('Show response time for specific or all registries')
.action(actions.onTest);
program
.parse(process.argv);
if (process.argv.length === 2) {
program.outputHelp();
}