Skip to content

Commit cf28192

Browse files
isaacsruyadorno
authored andcommitted
Improve abbrevs for install and help
The existence of 'install-test' and 'install-clean' make 'npm inst' no longer de-reference to 'npm install'. Similarly, the existence of 'help-search' prevents 'hel' from being a shorthand for 'help'. This adds some artisanally hand-crafted abbreviations for these cases. Fix: #1617 PR-URL: #1622 Credit: @isaacs Close: #1622 Reviewed-by: @ruyadorno
1 parent 0d9b127 commit cf28192

File tree

4 files changed

+43
-22
lines changed

4 files changed

+43
-22
lines changed

lib/config/cmd-list.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,19 @@ const affordances = {
2828
verison: 'version',
2929
ic: 'ci',
3030
innit: 'init',
31-
isntall: 'install',
31+
// manually abbrev so that install-test doesn't make insta stop working
32+
in: 'install',
33+
ins: 'install',
34+
inst: 'install',
35+
insta: 'install',
36+
instal: 'install',
37+
isnt: 'install',
38+
isnta: 'install',
39+
isntal: 'install',
3240
'install-clean': 'ci',
3341
'isntall-clean': 'ci',
42+
hlep: 'help',
3443
'dist-tags': 'dist-tag',
35-
apihelp: 'help',
3644
upgrade: 'update',
3745
udpate: 'update',
3846
login: 'adduser',
@@ -95,7 +103,6 @@ const cmdList = [
95103
'org',
96104

97105
'help',
98-
'help-search',
99106
'ls',
100107
'll',
101108
'search',
@@ -124,7 +131,7 @@ const cmdList = [
124131
'exec'
125132
]
126133

127-
const plumbing = ['birthday']
134+
const plumbing = ['birthday', 'help-search']
128135
module.exports = {
129136
aliases: Object.assign({}, shorthands, affordances),
130137
shorthands,

tap-snapshots/test-lib-config-cmd-list.js-TAP.test.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,23 @@ Object {
1010
"affordances": Object {
1111
"add": "install",
1212
"add-user": "adduser",
13-
"apihelp": "help",
1413
"author": "owner",
1514
"dist-tags": "dist-tag",
1615
"find": "search",
16+
"hlep": "help",
1717
"home": "docs",
1818
"ic": "ci",
19+
"in": "install",
1920
"info": "view",
2021
"innit": "init",
22+
"ins": "install",
23+
"inst": "install",
24+
"insta": "install",
25+
"instal": "install",
2126
"install-clean": "ci",
22-
"isntall": "install",
27+
"isnt": "install",
28+
"isnta": "install",
29+
"isntal": "install",
2330
"isntall-clean": "ci",
2431
"issues": "bugs",
2532
"la": "ll",
@@ -40,7 +47,6 @@ Object {
4047
"aliases": Object {
4148
"add": "install",
4249
"add-user": "adduser",
43-
"apihelp": "help",
4450
"author": "owner",
4551
"c": "config",
4652
"cit": "install-ci-test",
@@ -50,13 +56,21 @@ Object {
5056
"ddp": "dedupe",
5157
"dist-tags": "dist-tag",
5258
"find": "search",
59+
"hlep": "help",
5360
"home": "docs",
5461
"i": "install",
5562
"ic": "ci",
63+
"in": "install",
5664
"info": "view",
5765
"innit": "init",
66+
"ins": "install",
67+
"inst": "install",
68+
"insta": "install",
69+
"instal": "install",
5870
"install-clean": "ci",
59-
"isntall": "install",
71+
"isnt": "install",
72+
"isnta": "install",
73+
"isntal": "install",
6074
"isntall-clean": "ci",
6175
"issues": "bugs",
6276
"it": "install-test",
@@ -125,7 +139,6 @@ Object {
125139
"fund",
126140
"org",
127141
"help",
128-
"help-search",
129142
"ls",
130143
"ll",
131144
"search",
@@ -154,6 +167,7 @@ Object {
154167
],
155168
"plumbing": Array [
156169
"birthday",
170+
"help-search",
157171
],
158172
"shorthands": Object {
159173
"c": "config",

tap-snapshots/test-lib-utils-update-notifier.js-TAP.test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,73 +6,73 @@
66
*/
77
'use strict'
88
exports[`test/lib/utils/update-notifier.js TAP notification situations color and unicode major > must match snapshot 1`] = `
9-
New [31mmajor[39m version of npm available! [31m<<major>>-beta.0[39m → [32m7.0.0[39m
9+
New [31mmajor[39m version of npm available! [31m<<major>>-beta.1[39m → [32m7.0.0[39m
1010
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
1111
Run npm install -g npm to update!
1212
`
1313

1414
exports[`test/lib/utils/update-notifier.js TAP notification situations color and unicode minor > must match snapshot 1`] = `
15-
New [33mminor[39m version of npm available! [31m<<minor>>-beta.0[39m → [32m7.0.0[39m
15+
New [33mminor[39m version of npm available! [31m<<minor>>-beta.1[39m → [32m7.0.0[39m
1616
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
1717
Run npm install -g npm to update!
1818
`
1919

2020
exports[`test/lib/utils/update-notifier.js TAP notification situations color and unicode minor > must match snapshot 2`] = `
21-
New [32mpatch[39m version of npm available! [31m<<patch>>-beta.0[39m → [32m7.0.0[39m
21+
New [32mpatch[39m version of npm available! [31m<<patch>>-beta.1[39m → [32m7.0.0[39m
2222
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
2323
Run npm install -g npm to update!
2424
`
2525

2626
exports[`test/lib/utils/update-notifier.js TAP notification situations color, no unicode major > must match snapshot 1`] = `
27-
New [31mmajor[39m version of npm available! [31m<<major>>-beta.0[39m -> [32m7.0.0[39m
27+
New [31mmajor[39m version of npm available! [31m<<major>>-beta.1[39m -> [32m7.0.0[39m
2828
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
2929
Run npm install -g npm to update!
3030
`
3131

3232
exports[`test/lib/utils/update-notifier.js TAP notification situations color, no unicode minor > must match snapshot 1`] = `
33-
New [33mminor[39m version of npm available! [31m<<minor>>-beta.0[39m -> [32m7.0.0[39m
33+
New [33mminor[39m version of npm available! [31m<<minor>>-beta.1[39m -> [32m7.0.0[39m
3434
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
3535
Run npm install -g npm to update!
3636
`
3737

3838
exports[`test/lib/utils/update-notifier.js TAP notification situations color, no unicode minor > must match snapshot 2`] = `
39-
New [32mpatch[39m version of npm available! [31m<<patch>>-beta.0[39m -> [32m7.0.0[39m
39+
New [32mpatch[39m version of npm available! [31m<<patch>>-beta.1[39m -> [32m7.0.0[39m
4040
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
4141
Run npm install -g npm to update!
4242
`
4343

4444
exports[`test/lib/utils/update-notifier.js TAP notification situations no color, no unicode major > must match snapshot 1`] = `
45-
New major version of npm available! <<major>>-beta.0 -> 7.0.0
45+
New major version of npm available! <<major>>-beta.1 -> 7.0.0
4646
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
4747
Run npm i -g npm to update!
4848
`
4949

5050
exports[`test/lib/utils/update-notifier.js TAP notification situations no color, no unicode minor > must match snapshot 1`] = `
51-
New minor version of npm available! <<minor>>-beta.0 -> 7.0.0
51+
New minor version of npm available! <<minor>>-beta.1 -> 7.0.0
5252
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
5353
Run npm i -g npm to update!
5454
`
5555

5656
exports[`test/lib/utils/update-notifier.js TAP notification situations no color, no unicode minor > must match snapshot 2`] = `
57-
New patch version of npm available! <<patch>>-beta.0 -> 7.0.0
57+
New patch version of npm available! <<patch>>-beta.1 -> 7.0.0
5858
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
5959
Run npm i -g npm to update!
6060
`
6161

6262
exports[`test/lib/utils/update-notifier.js TAP notification situations unicode, no color major > must match snapshot 1`] = `
63-
New major version of npm available! <<major>>-beta.0 → 7.0.0
63+
New major version of npm available! <<major>>-beta.1 → 7.0.0
6464
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
6565
Run npm i -g npm to update!
6666
`
6767

6868
exports[`test/lib/utils/update-notifier.js TAP notification situations unicode, no color minor > must match snapshot 1`] = `
69-
New minor version of npm available! <<minor>>-beta.0 → 7.0.0
69+
New minor version of npm available! <<minor>>-beta.1 → 7.0.0
7070
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
7171
Run npm i -g npm to update!
7272
`
7373

7474
exports[`test/lib/utils/update-notifier.js TAP notification situations unicode, no color minor > must match snapshot 2`] = `
75-
New patch version of npm available! <<patch>>-beta.0 → 7.0.0
75+
New patch version of npm available! <<patch>>-beta.1 → 7.0.0
7676
Changelog: https://github.com/npm/cli/releases/tag/v7.0.0
7777
Run npm i -g npm to update!
7878
`

tap-snapshots/test-lib-view.js-TAP.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ dist
282282
dist-tags:
283283
284284
285-
published [33m12 months ago[39m
285+
published [33ma year ago[39m
286286
`
287287

288288
exports[`test/lib/view.js TAP should log package info package with no versions > must match snapshot 1`] = `

0 commit comments

Comments
 (0)