From d8dcc02cfd354c1314c45d6530ec926cd138210c Mon Sep 17 00:00:00 2001 From: Gar Date: Thu, 24 Mar 2022 07:18:56 -0700 Subject: fix: consolidate command alias code --- .../test/lib/commands/completion.js.test.cjs | 136 +++--- .../test/lib/load-all-commands.js.test.cjs | 8 +- tap-snapshots/test/lib/utils/cmd-list.js.test.cjs | 508 ++++++++++++++++----- tap-snapshots/test/lib/utils/npm-usage.js.test.cjs | 8 +- 4 files changed, 471 insertions(+), 189 deletions(-) (limited to 'tap-snapshots') diff --git a/tap-snapshots/test/lib/commands/completion.js.test.cjs b/tap-snapshots/test/lib/commands/completion.js.test.cjs index 4fa3a2179..232cfec66 100644 --- a/tap-snapshots/test/lib/commands/completion.js.test.cjs +++ b/tap-snapshots/test/lib/commands/completion.js.test.cjs @@ -44,72 +44,84 @@ exports[`test/lib/commands/completion.js TAP completion double dashes escape fro Array [ Array [ String( - ci - install-ci-test - install - install-test - uninstall + access + adduser + audit + bin + bugs cache + ci + completion config - set - get - update - outdated - prune - pack - find-dupes dedupe + deprecate + diff + dist-tag + docs + doctor + edit + exec + explain + explore + find-dupes + fund + get + help hook - rebuild + init + install + install-ci-test + install-test link - publish - star - stars - unstar - adduser + ll login logout - unpublish - owner - access - team - deprecate - shrinkwrap - token - profile - audit - fund - org - help ls - ll - search - view - init - version - edit - explore - docs - repo - bugs - root - prefix - bin - whoami - diff - dist-tag + org + outdated + owner + pack ping pkg - test - stop - start + prefix + profile + prune + publish + rebuild + repo restart + root run-script + search + set set-script - completion - doctor - exec - explain + shrinkwrap + star + stars + start + stop + team + test + token + uninstall + unpublish + unstar + update + version + view + whoami + login + author + home + issues + info + show + find + add + unlink + remove + rm + r un rb list @@ -150,23 +162,11 @@ Array [ dist-tags upgrade udpate - login - add-user - author - home - issues - info - show - find - add - unlink - remove - rm - r rum sit urn ogr + add-user ), ], ] @@ -198,12 +198,12 @@ exports[`test/lib/commands/completion.js TAP completion multiple command names > Array [ Array [ String( - adduser access + adduser audit - add-user author add + add-user ), ], ] diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index 550c59613..0ad87b945 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -426,7 +426,7 @@ Options: [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] -aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add +aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall Run "npm help install" for more info ` @@ -784,7 +784,7 @@ Options: [--no-description] [--searchopts ] [--searchexclude ] [--registry ] [--prefer-online] [--prefer-offline] [--offline] -aliases: s, se, find +aliases: find, s, se Run "npm help search" for more info ` @@ -924,7 +924,7 @@ Options: [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] -aliases: un, unlink, remove, rm, r +aliases: unlink, remove, rm, r, un Run "npm help uninstall" for more info ` @@ -1002,7 +1002,7 @@ Options: [--json] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] -aliases: v, info, show +aliases: info, show, v Run "npm help view" for more info ` diff --git a/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs b/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs index e5935846e..9413f8e9a 100644 --- a/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs +++ b/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs @@ -7,43 +7,348 @@ 'use strict' exports[`test/lib/utils/cmd-list.js TAP > must match snapshot 1`] = ` Object { - "affordances": Object { - "add": "install", - "add-user": "adduser", - "author": "owner", - "dist-tags": "dist-tag", - "find": "search", - "hlep": "help", - "home": "docs", - "ic": "ci", - "in": "install", - "info": "view", - "innit": "init", - "ins": "install", - "inst": "install", - "insta": "install", - "instal": "install", - "install-clean": "ci", - "isnt": "install", - "isnta": "install", - "isntal": "install", - "isntall": "install", - "isntall-clean": "ci", - "issues": "bugs", - "la": "ll", - "login": "adduser", - "ogr": "org", - "r": "uninstall", - "remove": "uninstall", - "rm": "uninstall", - "rum": "run-script", - "show": "view", - "sit": "cit", - "udpate": "update", - "unlink": "uninstall", - "upgrade": "update", - "urn": "run-script", - "verison": "version", + "abbrevs": Object { + "ac": "access", + "acc": "access", + "acce": "access", + "acces": "access", + "access": "access", + "add": "add", + "add-": "add-user", + "add-u": "add-user", + "add-us": "add-user", + "add-use": "add-user", + "add-user": "add-user", + "addu": "adduser", + "addus": "adduser", + "adduse": "adduser", + "adduser": "adduser", + "aud": "audit", + "audi": "audit", + "audit": "audit", + "aut": "author", + "auth": "author", + "autho": "author", + "author": "author", + "bi": "bin", + "bin": "bin", + "bu": "bugs", + "bug": "bugs", + "bugs": "bugs", + "c": "c", + "ca": "cache", + "cac": "cache", + "cach": "cache", + "cache": "cache", + "ci": "ci", + "cit": "cit", + "clean-install": "clean-install", + "clean-install-": "clean-install-test", + "clean-install-t": "clean-install-test", + "clean-install-te": "clean-install-test", + "clean-install-tes": "clean-install-test", + "clean-install-test": "clean-install-test", + "com": "completion", + "comp": "completion", + "compl": "completion", + "comple": "completion", + "complet": "completion", + "completi": "completion", + "completio": "completion", + "completion": "completion", + "con": "config", + "conf": "config", + "confi": "config", + "config": "config", + "cr": "create", + "cre": "create", + "crea": "create", + "creat": "create", + "create": "create", + "dd": "ddp", + "ddp": "ddp", + "ded": "dedupe", + "dedu": "dedupe", + "dedup": "dedupe", + "dedupe": "dedupe", + "dep": "deprecate", + "depr": "deprecate", + "depre": "deprecate", + "deprec": "deprecate", + "depreca": "deprecate", + "deprecat": "deprecate", + "deprecate": "deprecate", + "dif": "diff", + "diff": "diff", + "dist-tag": "dist-tag", + "dist-tags": "dist-tags", + "docs": "docs", + "doct": "doctor", + "docto": "doctor", + "doctor": "doctor", + "ed": "edit", + "edi": "edit", + "edit": "edit", + "exe": "exec", + "exec": "exec", + "expla": "explain", + "explai": "explain", + "explain": "explain", + "explo": "explore", + "explor": "explore", + "explore": "explore", + "find": "find", + "find-": "find-dupes", + "find-d": "find-dupes", + "find-du": "find-dupes", + "find-dup": "find-dupes", + "find-dupe": "find-dupes", + "find-dupes": "find-dupes", + "fu": "fund", + "fun": "fund", + "fund": "fund", + "g": "get", + "ge": "get", + "get": "get", + "he": "help", + "hel": "help", + "help": "help", + "hl": "hlep", + "hle": "hlep", + "hlep": "hlep", + "hom": "home", + "home": "home", + "hoo": "hook", + "hook": "hook", + "i": "i", + "ic": "ic", + "in": "in", + "inf": "info", + "info": "info", + "ini": "init", + "init": "init", + "inn": "innit", + "inni": "innit", + "innit": "innit", + "ins": "ins", + "inst": "inst", + "insta": "insta", + "instal": "instal", + "install": "install", + "install-ci": "install-ci-test", + "install-ci-": "install-ci-test", + "install-ci-t": "install-ci-test", + "install-ci-te": "install-ci-test", + "install-ci-tes": "install-ci-test", + "install-ci-test": "install-ci-test", + "install-cl": "install-clean", + "install-cle": "install-clean", + "install-clea": "install-clean", + "install-clean": "install-clean", + "install-t": "install-test", + "install-te": "install-test", + "install-tes": "install-test", + "install-test": "install-test", + "isnt": "isnt", + "isnta": "isnta", + "isntal": "isntal", + "isntall": "isntall", + "isntall-": "isntall-clean", + "isntall-c": "isntall-clean", + "isntall-cl": "isntall-clean", + "isntall-cle": "isntall-clean", + "isntall-clea": "isntall-clean", + "isntall-clean": "isntall-clean", + "iss": "issues", + "issu": "issues", + "issue": "issues", + "issues": "issues", + "it": "it", + "la": "la", + "lin": "link", + "link": "link", + "lis": "list", + "list": "list", + "ll": "ll", + "ln": "ln", + "logi": "login", + "login": "login", + "logo": "logout", + "logou": "logout", + "logout": "logout", + "ls": "ls", + "og": "ogr", + "ogr": "ogr", + "or": "org", + "org": "org", + "ou": "outdated", + "out": "outdated", + "outd": "outdated", + "outda": "outdated", + "outdat": "outdated", + "outdate": "outdated", + "outdated": "outdated", + "ow": "owner", + "own": "owner", + "owne": "owner", + "owner": "owner", + "pa": "pack", + "pac": "pack", + "pack": "pack", + "pi": "ping", + "pin": "ping", + "ping": "ping", + "pk": "pkg", + "pkg": "pkg", + "pre": "prefix", + "pref": "prefix", + "prefi": "prefix", + "prefix": "prefix", + "pro": "profile", + "prof": "profile", + "profi": "profile", + "profil": "profile", + "profile": "profile", + "pru": "prune", + "prun": "prune", + "prune": "prune", + "pu": "publish", + "pub": "publish", + "publ": "publish", + "publi": "publish", + "publis": "publish", + "publish": "publish", + "r": "r", + "rb": "rb", + "reb": "rebuild", + "rebu": "rebuild", + "rebui": "rebuild", + "rebuil": "rebuild", + "rebuild": "rebuild", + "rem": "remove", + "remo": "remove", + "remov": "remove", + "remove": "remove", + "rep": "repo", + "repo": "repo", + "res": "restart", + "rest": "restart", + "resta": "restart", + "restar": "restart", + "restart": "restart", + "rm": "rm", + "ro": "root", + "roo": "root", + "root": "root", + "rum": "rum", + "run": "run", + "run-": "run-script", + "run-s": "run-script", + "run-sc": "run-script", + "run-scr": "run-script", + "run-scri": "run-script", + "run-scrip": "run-script", + "run-script": "run-script", + "s": "s", + "se": "se", + "sea": "search", + "sear": "search", + "searc": "search", + "search": "search", + "set": "set", + "set-": "set-script", + "set-s": "set-script", + "set-sc": "set-script", + "set-scr": "set-script", + "set-scri": "set-script", + "set-scrip": "set-script", + "set-script": "set-script", + "sho": "show", + "show": "show", + "shr": "shrinkwrap", + "shri": "shrinkwrap", + "shrin": "shrinkwrap", + "shrink": "shrinkwrap", + "shrinkw": "shrinkwrap", + "shrinkwr": "shrinkwrap", + "shrinkwra": "shrinkwrap", + "shrinkwrap": "shrinkwrap", + "si": "sit", + "sit": "sit", + "star": "star", + "stars": "stars", + "start": "start", + "sto": "stop", + "stop": "stop", + "t": "t", + "tea": "team", + "team": "team", + "tes": "test", + "test": "test", + "to": "token", + "tok": "token", + "toke": "token", + "token": "token", + "ts": "tst", + "tst": "tst", + "ud": "udpate", + "udp": "udpate", + "udpa": "udpate", + "udpat": "udpate", + "udpate": "udpate", + "un": "un", + "uni": "uninstall", + "unin": "uninstall", + "unins": "uninstall", + "uninst": "uninstall", + "uninsta": "uninstall", + "uninstal": "uninstall", + "uninstall": "uninstall", + "unl": "unlink", + "unli": "unlink", + "unlin": "unlink", + "unlink": "unlink", + "unp": "unpublish", + "unpu": "unpublish", + "unpub": "unpublish", + "unpubl": "unpublish", + "unpubli": "unpublish", + "unpublis": "unpublish", + "unpublish": "unpublish", + "uns": "unstar", + "unst": "unstar", + "unsta": "unstar", + "unstar": "unstar", + "up": "up", + "upd": "update", + "upda": "update", + "updat": "update", + "update": "update", + "upg": "upgrade", + "upgr": "upgrade", + "upgra": "upgrade", + "upgrad": "upgrade", + "upgrade": "upgrade", + "ur": "urn", + "urn": "urn", + "v": "v", + "veri": "verison", + "veris": "verison", + "veriso": "verison", + "verison": "verison", + "vers": "version", + "versi": "version", + "versio": "version", + "version": "version", + "vi": "view", + "vie": "view", + "view": "view", + "who": "whoami", + "whoa": "whoami", + "whoam": "whoami", + "whoami": "whoami", + "why": "why", + "x": "x", }, "aliases": Object { "add": "install", @@ -105,99 +410,76 @@ Object { "x": "exec", }, "cmdList": Array [ - "ci", - "install-ci-test", - "install", - "install-test", - "uninstall", + "access", + "adduser", + "audit", + "bin", + "bugs", "cache", + "ci", + "completion", "config", - "set", - "get", - "update", - "outdated", - "prune", - "pack", - "find-dupes", "dedupe", + "deprecate", + "diff", + "dist-tag", + "docs", + "doctor", + "edit", + "exec", + "explain", + "explore", + "find-dupes", + "fund", + "get", + "help", "hook", - "rebuild", + "init", + "install", + "install-ci-test", + "install-test", "link", - "publish", - "star", - "stars", - "unstar", - "adduser", + "ll", "login", "logout", - "unpublish", - "owner", - "access", - "team", - "deprecate", - "shrinkwrap", - "token", - "profile", - "audit", - "fund", - "org", - "help", "ls", - "ll", - "search", - "view", - "init", - "version", - "edit", - "explore", - "docs", - "repo", - "bugs", - "root", - "prefix", - "bin", - "whoami", - "diff", - "dist-tag", + "org", + "outdated", + "owner", + "pack", "ping", "pkg", - "test", - "stop", - "start", + "prefix", + "profile", + "prune", + "publish", + "rebuild", + "repo", "restart", + "root", "run-script", + "search", + "set", "set-script", - "completion", - "doctor", - "exec", - "explain", + "shrinkwrap", + "star", + "stars", + "start", + "stop", + "team", + "test", + "token", + "uninstall", + "unpublish", + "unstar", + "update", + "version", + "view", + "whoami", ], "plumbing": Array [ "birthday", "help-search", ], - "shorthands": Object { - "c": "config", - "cit": "install-ci-test", - "clean-install": "ci", - "clean-install-test": "cit", - "create": "init", - "ddp": "dedupe", - "i": "install", - "it": "install-test", - "list": "ls", - "ln": "link", - "rb": "rebuild", - "run": "run-script", - "s": "search", - "se": "search", - "t": "test", - "tst": "test", - "un": "uninstall", - "up": "update", - "v": "view", - "why": "explain", - "x": "exec", - }, } ` diff --git a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs index 1f4b0292c..e6afc973a 100644 --- a/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs +++ b/tap-snapshots/test/lib/utils/npm-usage.js.test.cjs @@ -514,7 +514,7 @@ All commands: [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] - aliases: i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall, add + aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall Run "npm help install" for more info @@ -826,7 +826,7 @@ All commands: [--no-description] [--searchopts ] [--searchexclude ] [--registry ] [--prefer-online] [--prefer-offline] [--offline] - aliases: s, se, find + aliases: find, s, se Run "npm help search" for more info @@ -944,7 +944,7 @@ All commands: [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] - aliases: un, unlink, remove, rm, r + aliases: unlink, remove, rm, r, un Run "npm help uninstall" for more info @@ -1012,7 +1012,7 @@ All commands: [--json] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] - aliases: v, info, show + aliases: info, show, v Run "npm help view" for more info -- cgit v1.2.3