@corellium/corellium-cli 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.gitlab-ci.yml +32 -1
- package/ci/gitlab-build.sh +1 -1
- package/coverage/cobertura-coverage.xml +9 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +101 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +0 -0
- package/index.js +2 -0
- package/package.json +62 -64
- package/src/clients/Instance.js +4 -0
- package/src/commands/extensions/delete.js +2 -1
- package/src/commands/extensions/list.js +3 -2
- package/src/commands/firmware/list.js +3 -2
- package/src/commands/images/create.js +2 -2
- package/src/commands/images/delete.js +1 -0
- package/src/commands/images/list.js +3 -2
- package/src/commands/index.js +0 -2
- package/src/commands/{agent → instances}/apps/index.js +3 -3
- package/src/commands/instances/create.js +9 -3
- package/src/commands/{agent → instances}/file.js +2 -2
- package/src/commands/instances/index.js +6 -1
- package/src/commands/instances/input.js +52 -0
- package/src/commands/instances/list.js +3 -2
- package/src/commands/instances/upgrade.js +2 -2
- package/src/commands/projects/create.js +2 -2
- package/src/commands/projects/delete.js +2 -1
- package/src/commands/projects/list.js +3 -2
- package/src/commands/webplayer/create.js +2 -2
- package/src/commands/webplayer/list.js +2 -2
- package/src/error.js +12 -6
- package/src/table.js +1 -1
- package/src/utils.js +19 -40
- package/node_modules/@babel/cli/LICENSE +0 -22
- package/node_modules/@babel/cli/README.md +0 -19
- package/node_modules/@babel/cli/bin/babel-external-helpers.js +0 -3
- package/node_modules/@babel/cli/bin/babel.js +0 -3
- package/node_modules/@babel/cli/index.js +0 -1
- package/node_modules/@babel/cli/lib/babel/dir.js +0 -285
- package/node_modules/@babel/cli/lib/babel/file.js +0 -273
- package/node_modules/@babel/cli/lib/babel/index.js +0 -20
- package/node_modules/@babel/cli/lib/babel/options.js +0 -285
- package/node_modules/@babel/cli/lib/babel/util.js +0 -181
- package/node_modules/@babel/cli/lib/babel/watcher.js +0 -162
- package/node_modules/@babel/cli/lib/babel-external-helpers.js +0 -43
- package/node_modules/@babel/cli/node_modules/commander/CHANGELOG.md +0 -436
- package/node_modules/@babel/cli/node_modules/commander/LICENSE +0 -22
- package/node_modules/@babel/cli/node_modules/commander/Readme.md +0 -713
- package/node_modules/@babel/cli/node_modules/commander/index.js +0 -1649
- package/node_modules/@babel/cli/node_modules/commander/package.json +0 -76
- package/node_modules/@babel/cli/node_modules/commander/typings/index.d.ts +0 -311
- package/node_modules/@babel/cli/node_modules/make-dir/index.d.ts +0 -39
- package/node_modules/@babel/cli/node_modules/make-dir/index.js +0 -139
- package/node_modules/@babel/cli/node_modules/make-dir/license +0 -9
- package/node_modules/@babel/cli/node_modules/make-dir/package.json +0 -94
- package/node_modules/@babel/cli/node_modules/make-dir/readme.md +0 -123
- package/node_modules/@babel/cli/node_modules/pify/index.js +0 -68
- package/node_modules/@babel/cli/node_modules/pify/license +0 -9
- package/node_modules/@babel/cli/node_modules/pify/package.json +0 -86
- package/node_modules/@babel/cli/node_modules/pify/readme.md +0 -145
- package/node_modules/@babel/cli/node_modules/semver/CHANGELOG.md +0 -39
- package/node_modules/@babel/cli/node_modules/semver/LICENSE +0 -15
- package/node_modules/@babel/cli/node_modules/semver/README.md +0 -412
- package/node_modules/@babel/cli/node_modules/semver/bin/semver +0 -160
- package/node_modules/@babel/cli/node_modules/semver/package.json +0 -63
- package/node_modules/@babel/cli/node_modules/semver/range.bnf +0 -16
- package/node_modules/@babel/cli/node_modules/semver/semver.js +0 -1483
- package/node_modules/@babel/cli/node_modules/slash/index.js +0 -11
- package/node_modules/@babel/cli/node_modules/slash/license +0 -9
- package/node_modules/@babel/cli/node_modules/slash/package.json +0 -69
- package/node_modules/@babel/cli/node_modules/slash/readme.md +0 -44
- package/node_modules/@babel/cli/package.json +0 -91
- package/node_modules/@corellium/client-api/README.md +0 -209
- package/node_modules/@corellium/client-api/dist/ApiClient.js +0 -780
- package/node_modules/@corellium/client-api/dist/api/CorelliumApi.js +0 -1744
- package/node_modules/@corellium/client-api/dist/index.js +0 -295
- package/node_modules/@corellium/client-api/dist/model/ApiConflictError.js +0 -114
- package/node_modules/@corellium/client-api/dist/model/ApiError.js +0 -101
- package/node_modules/@corellium/client-api/dist/model/ApiNotFoundError.js +0 -111
- package/node_modules/@corellium/client-api/dist/model/ApiToken.js +0 -78
- package/node_modules/@corellium/client-api/dist/model/Bit.js +0 -50
- package/node_modules/@corellium/client-api/dist/model/Credentials.js +0 -91
- package/node_modules/@corellium/client-api/dist/model/Firmware.js +0 -208
- package/node_modules/@corellium/client-api/dist/model/GpioStateDefinition.js +0 -93
- package/node_modules/@corellium/client-api/dist/model/Image.js +0 -249
- package/node_modules/@corellium/client-api/dist/model/Instance.js +0 -313
- package/node_modules/@corellium/client-api/dist/model/InstanceBootOptions.js +0 -134
- package/node_modules/@corellium/client-api/dist/model/InstanceConsoleEndpoint.js +0 -76
- package/node_modules/@corellium/client-api/dist/model/InstanceCreateOptions.js +0 -224
- package/node_modules/@corellium/client-api/dist/model/InstanceNetmonState.js +0 -75
- package/node_modules/@corellium/client-api/dist/model/InstanceReturn.js +0 -92
- package/node_modules/@corellium/client-api/dist/model/InstanceServices.js +0 -77
- package/node_modules/@corellium/client-api/dist/model/InstanceStartOptions.js +0 -76
- package/node_modules/@corellium/client-api/dist/model/InstanceState.js +0 -64
- package/node_modules/@corellium/client-api/dist/model/InstanceStopOptions.js +0 -76
- package/node_modules/@corellium/client-api/dist/model/Model.js +0 -165
- package/node_modules/@corellium/client-api/dist/model/ModelSoftware.js +0 -122
- package/node_modules/@corellium/client-api/dist/model/PeripheralsData.js +0 -147
- package/node_modules/@corellium/client-api/dist/model/Project.js +0 -122
- package/node_modules/@corellium/client-api/dist/model/ProjectQuota.js +0 -93
- package/node_modules/@corellium/client-api/dist/model/ProjectSettings.js +0 -93
- package/node_modules/@corellium/client-api/dist/model/ProjectUsage.js +0 -102
- package/node_modules/@corellium/client-api/dist/model/Snapshot.js +0 -145
- package/node_modules/@corellium/client-api/dist/model/SnapshotCreationOptions.js +0 -79
- package/node_modules/@corellium/client-api/dist/model/SnapshotStatus.js +0 -84
- package/node_modules/@corellium/client-api/dist/model/Token.js +0 -88
- package/node_modules/@corellium/client-api/dist/model/UserError.js +0 -114
- package/node_modules/@corellium/client-api/dist/model/V1SetStateBody.js +0 -80
- package/node_modules/@corellium/client-api/dist/model/VolumeOptions.js +0 -94
- package/node_modules/@corellium/client-api/dist/model/VpnDefinition.js +0 -84
- package/node_modules/@corellium/client-api/package.json +0 -75
- package/node_modules/@jridgewell/resolve-uri/LICENSE +0 -19
- package/node_modules/@jridgewell/resolve-uri/README.md +0 -40
- package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs +0 -242
- package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map +0 -1
- package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js +0 -250
- package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map +0 -1
- package/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +0 -4
- package/node_modules/@jridgewell/resolve-uri/package.json +0 -108
- package/node_modules/@jridgewell/sourcemap-codec/LICENSE +0 -21
- package/node_modules/@jridgewell/sourcemap-codec/README.md +0 -200
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -164
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +0 -1
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +0 -175
- package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +0 -1
- package/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts +0 -6
- package/node_modules/@jridgewell/sourcemap-codec/package.json +0 -110
- package/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +0 -198
- package/node_modules/@jridgewell/trace-mapping/LICENSE +0 -19
- package/node_modules/@jridgewell/trace-mapping/README.md +0 -252
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +0 -518
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +0 -1
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +0 -532
- package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +0 -1
- package/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts +0 -8
- package/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts +0 -32
- package/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts +0 -7
- package/node_modules/@jridgewell/trace-mapping/dist/types/resolve.d.ts +0 -1
- package/node_modules/@jridgewell/trace-mapping/dist/types/sort.d.ts +0 -2
- package/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +0 -16
- package/node_modules/@jridgewell/trace-mapping/dist/types/strip-filename.d.ts +0 -4
- package/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +0 -74
- package/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts +0 -85
- package/node_modules/@jridgewell/trace-mapping/package.json +0 -112
- package/node_modules/@jridgewell/trace-mapping/src/any-map.ts +0 -166
- package/node_modules/@jridgewell/trace-mapping/src/binary-search.ts +0 -115
- package/node_modules/@jridgewell/trace-mapping/src/by-source.ts +0 -64
- package/node_modules/@jridgewell/trace-mapping/src/resolve.ts +0 -10
- package/node_modules/@jridgewell/trace-mapping/src/sort.ts +0 -45
- package/node_modules/@jridgewell/trace-mapping/src/sourcemap-segment.ts +0 -23
- package/node_modules/@jridgewell/trace-mapping/src/strip-filename.ts +0 -8
- package/node_modules/@jridgewell/trace-mapping/src/trace-mapping.ts +0 -405
- package/node_modules/@jridgewell/trace-mapping/src/types.ts +0 -90
- package/node_modules/@nicolo-ribaudo/chokidar-2/README.md +0 -3
- package/node_modules/@nicolo-ribaudo/chokidar-2/build-chokidar.sh +0 -30
- package/node_modules/@nicolo-ribaudo/chokidar-2/dist/main.js +0 -2086
- package/node_modules/@nicolo-ribaudo/chokidar-2/package.json +0 -73
- package/node_modules/@nicolo-ribaudo/chokidar-2/types.d.ts +0 -191
- package/node_modules/ansi-regex/index.d.ts +0 -37
- package/node_modules/ansi-regex/index.js +0 -10
- package/node_modules/ansi-regex/license +0 -9
- package/node_modules/ansi-regex/package.json +0 -90
- package/node_modules/ansi-regex/readme.md +0 -78
- package/node_modules/ansi-styles/index.d.ts +0 -345
- package/node_modules/ansi-styles/index.js +0 -163
- package/node_modules/ansi-styles/license +0 -9
- package/node_modules/ansi-styles/package.json +0 -96
- package/node_modules/ansi-styles/readme.md +0 -152
- package/node_modules/anymatch/LICENSE +0 -15
- package/node_modules/anymatch/README.md +0 -87
- package/node_modules/anymatch/index.d.ts +0 -19
- package/node_modules/anymatch/index.js +0 -104
- package/node_modules/anymatch/package.json +0 -80
- package/node_modules/asynckit/LICENSE +0 -21
- package/node_modules/asynckit/README.md +0 -233
- package/node_modules/asynckit/bench.js +0 -76
- package/node_modules/asynckit/index.js +0 -6
- package/node_modules/asynckit/lib/abort.js +0 -29
- package/node_modules/asynckit/lib/async.js +0 -34
- package/node_modules/asynckit/lib/defer.js +0 -26
- package/node_modules/asynckit/lib/iterate.js +0 -75
- package/node_modules/asynckit/lib/readable_asynckit.js +0 -91
- package/node_modules/asynckit/lib/readable_parallel.js +0 -25
- package/node_modules/asynckit/lib/readable_serial.js +0 -25
- package/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
- package/node_modules/asynckit/lib/state.js +0 -37
- package/node_modules/asynckit/lib/streamify.js +0 -141
- package/node_modules/asynckit/lib/terminator.js +0 -29
- package/node_modules/asynckit/package.json +0 -96
- package/node_modules/asynckit/parallel.js +0 -43
- package/node_modules/asynckit/serial.js +0 -17
- package/node_modules/asynckit/serialOrdered.js +0 -75
- package/node_modules/asynckit/stream.js +0 -21
- package/node_modules/axios/CHANGELOG.md +0 -943
- package/node_modules/axios/LICENSE +0 -19
- package/node_modules/axios/README.md +0 -991
- package/node_modules/axios/SECURITY.md +0 -5
- package/node_modules/axios/UPGRADE_GUIDE.md +0 -168
- package/node_modules/axios/dist/axios.js +0 -2595
- package/node_modules/axios/dist/axios.map +0 -1
- package/node_modules/axios/dist/axios.min.js +0 -3
- package/node_modules/axios/dist/axios.min.map +0 -1
- package/node_modules/axios/index.d.ts +0 -254
- package/node_modules/axios/index.js +0 -1
- package/node_modules/axios/lib/adapters/README.md +0 -37
- package/node_modules/axios/lib/adapters/http.js +0 -424
- package/node_modules/axios/lib/adapters/xhr.js +0 -222
- package/node_modules/axios/lib/axios.js +0 -64
- package/node_modules/axios/lib/cancel/CancelToken.js +0 -119
- package/node_modules/axios/lib/cancel/CanceledError.js +0 -22
- package/node_modules/axios/lib/cancel/isCancel.js +0 -5
- package/node_modules/axios/lib/core/Axios.js +0 -160
- package/node_modules/axios/lib/core/AxiosError.js +0 -86
- package/node_modules/axios/lib/core/InterceptorManager.js +0 -54
- package/node_modules/axios/lib/core/README.md +0 -8
- package/node_modules/axios/lib/core/buildFullPath.js +0 -20
- package/node_modules/axios/lib/core/dispatchRequest.js +0 -87
- package/node_modules/axios/lib/core/mergeConfig.js +0 -100
- package/node_modules/axios/lib/core/settle.js +0 -25
- package/node_modules/axios/lib/core/transformData.js +0 -22
- package/node_modules/axios/lib/defaults/env/FormData.js +0 -2
- package/node_modules/axios/lib/defaults/index.js +0 -146
- package/node_modules/axios/lib/defaults/transitional.js +0 -7
- package/node_modules/axios/lib/env/README.md +0 -3
- package/node_modules/axios/lib/env/data.js +0 -3
- package/node_modules/axios/lib/helpers/README.md +0 -7
- package/node_modules/axios/lib/helpers/bind.js +0 -11
- package/node_modules/axios/lib/helpers/buildURL.js +0 -70
- package/node_modules/axios/lib/helpers/combineURLs.js +0 -14
- package/node_modules/axios/lib/helpers/cookies.js +0 -53
- package/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -24
- package/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -14
- package/node_modules/axios/lib/helpers/isAxiosError.js +0 -13
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -68
- package/node_modules/axios/lib/helpers/normalizeHeaderName.js +0 -12
- package/node_modules/axios/lib/helpers/null.js +0 -2
- package/node_modules/axios/lib/helpers/parseHeaders.js +0 -53
- package/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
- package/node_modules/axios/lib/helpers/spread.js +0 -27
- package/node_modules/axios/lib/helpers/toFormData.js +0 -72
- package/node_modules/axios/lib/helpers/validator.js +0 -86
- package/node_modules/axios/lib/utils.js +0 -470
- package/node_modules/axios/package.json +0 -117
- package/node_modules/axios/tsconfig.json +0 -14
- package/node_modules/axios/tslint.json +0 -6
- package/node_modules/balanced-match/.github/FUNDING.yml +0 -2
- package/node_modules/balanced-match/LICENSE.md +0 -21
- package/node_modules/balanced-match/README.md +0 -97
- package/node_modules/balanced-match/index.js +0 -62
- package/node_modules/balanced-match/package.json +0 -79
- package/node_modules/binary-extensions/binary-extensions.json +0 -260
- package/node_modules/binary-extensions/binary-extensions.json.d.ts +0 -3
- package/node_modules/binary-extensions/index.d.ts +0 -14
- package/node_modules/binary-extensions/index.js +0 -1
- package/node_modules/binary-extensions/license +0 -9
- package/node_modules/binary-extensions/package.json +0 -74
- package/node_modules/binary-extensions/readme.md +0 -41
- package/node_modules/brace-expansion/LICENSE +0 -21
- package/node_modules/brace-expansion/README.md +0 -129
- package/node_modules/brace-expansion/index.js +0 -201
- package/node_modules/brace-expansion/package.json +0 -78
- package/node_modules/braces/CHANGELOG.md +0 -184
- package/node_modules/braces/LICENSE +0 -21
- package/node_modules/braces/README.md +0 -593
- package/node_modules/braces/index.js +0 -170
- package/node_modules/braces/lib/compile.js +0 -57
- package/node_modules/braces/lib/constants.js +0 -57
- package/node_modules/braces/lib/expand.js +0 -113
- package/node_modules/braces/lib/parse.js +0 -333
- package/node_modules/braces/lib/stringify.js +0 -32
- package/node_modules/braces/lib/utils.js +0 -112
- package/node_modules/braces/package.json +0 -127
- package/node_modules/call-bind/.eslintignore +0 -1
- package/node_modules/call-bind/.eslintrc +0 -17
- package/node_modules/call-bind/.github/FUNDING.yml +0 -12
- package/node_modules/call-bind/.nycrc +0 -13
- package/node_modules/call-bind/CHANGELOG.md +0 -42
- package/node_modules/call-bind/LICENSE +0 -21
- package/node_modules/call-bind/README.md +0 -2
- package/node_modules/call-bind/callBound.js +0 -15
- package/node_modules/call-bind/index.js +0 -47
- package/node_modules/call-bind/package.json +0 -126
- package/node_modules/call-bind/test/callBound.js +0 -55
- package/node_modules/call-bind/test/index.js +0 -66
- package/node_modules/chokidar/LICENSE +0 -21
- package/node_modules/chokidar/README.md +0 -308
- package/node_modules/chokidar/index.js +0 -973
- package/node_modules/chokidar/lib/constants.js +0 -65
- package/node_modules/chokidar/lib/fsevents-handler.js +0 -524
- package/node_modules/chokidar/lib/nodefs-handler.js +0 -654
- package/node_modules/chokidar/package.json +0 -123
- package/node_modules/chokidar/types/index.d.ts +0 -188
- package/node_modules/cliui/CHANGELOG.md +0 -121
- package/node_modules/cliui/LICENSE.txt +0 -14
- package/node_modules/cliui/README.md +0 -141
- package/node_modules/cliui/build/index.cjs +0 -302
- package/node_modules/cliui/build/lib/index.js +0 -287
- package/node_modules/cliui/build/lib/string-utils.js +0 -27
- package/node_modules/cliui/index.mjs +0 -13
- package/node_modules/cliui/package.json +0 -121
- package/node_modules/color-convert/CHANGELOG.md +0 -54
- package/node_modules/color-convert/LICENSE +0 -21
- package/node_modules/color-convert/README.md +0 -68
- package/node_modules/color-convert/conversions.js +0 -839
- package/node_modules/color-convert/index.js +0 -81
- package/node_modules/color-convert/package.json +0 -86
- package/node_modules/color-convert/route.js +0 -97
- package/node_modules/color-name/LICENSE +0 -8
- package/node_modules/color-name/README.md +0 -11
- package/node_modules/color-name/index.js +0 -152
- package/node_modules/color-name/package.json +0 -60
- package/node_modules/combined-stream/License +0 -19
- package/node_modules/combined-stream/Readme.md +0 -138
- package/node_modules/combined-stream/lib/combined_stream.js +0 -208
- package/node_modules/combined-stream/package.json +0 -62
- package/node_modules/combined-stream/yarn.lock +0 -17
- package/node_modules/component-emitter/History.md +0 -75
- package/node_modules/component-emitter/LICENSE +0 -24
- package/node_modules/component-emitter/Readme.md +0 -74
- package/node_modules/component-emitter/index.js +0 -175
- package/node_modules/component-emitter/package.json +0 -59
- package/node_modules/concat-map/.travis.yml +0 -4
- package/node_modules/concat-map/LICENSE +0 -18
- package/node_modules/concat-map/README.markdown +0 -62
- package/node_modules/concat-map/example/map.js +0 -6
- package/node_modules/concat-map/index.js +0 -13
- package/node_modules/concat-map/package.json +0 -91
- package/node_modules/concat-map/test/map.js +0 -39
- package/node_modules/convert-source-map/LICENSE +0 -23
- package/node_modules/convert-source-map/README.md +0 -120
- package/node_modules/convert-source-map/index.js +0 -136
- package/node_modules/convert-source-map/package.json +0 -75
- package/node_modules/cookiejar/LICENSE +0 -9
- package/node_modules/cookiejar/cookiejar.js +0 -276
- package/node_modules/cookiejar/package.json +0 -58
- package/node_modules/cookiejar/readme.md +0 -60
- package/node_modules/debug/LICENSE +0 -20
- package/node_modules/debug/README.md +0 -481
- package/node_modules/debug/package.json +0 -113
- package/node_modules/debug/src/browser.js +0 -269
- package/node_modules/debug/src/common.js +0 -274
- package/node_modules/debug/src/index.js +0 -10
- package/node_modules/debug/src/node.js +0 -263
- package/node_modules/delayed-stream/.npmignore +0 -1
- package/node_modules/delayed-stream/License +0 -19
- package/node_modules/delayed-stream/Makefile +0 -7
- package/node_modules/delayed-stream/Readme.md +0 -141
- package/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
- package/node_modules/delayed-stream/package.json +0 -65
- package/node_modules/dotenv/CHANGELOG.md +0 -356
- package/node_modules/dotenv/LICENSE +0 -23
- package/node_modules/dotenv/README.md +0 -408
- package/node_modules/dotenv/config.d.ts +0 -1
- package/node_modules/dotenv/config.js +0 -9
- package/node_modules/dotenv/lib/cli-options.js +0 -11
- package/node_modules/dotenv/lib/env-options.js +0 -20
- package/node_modules/dotenv/lib/main.d.ts +0 -73
- package/node_modules/dotenv/lib/main.js +0 -109
- package/node_modules/dotenv/package.json +0 -87
- package/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
- package/node_modules/emoji-regex/README.md +0 -73
- package/node_modules/emoji-regex/es2015/index.js +0 -6
- package/node_modules/emoji-regex/es2015/text.js +0 -6
- package/node_modules/emoji-regex/index.d.ts +0 -23
- package/node_modules/emoji-regex/index.js +0 -6
- package/node_modules/emoji-regex/package.json +0 -80
- package/node_modules/emoji-regex/text.js +0 -6
- package/node_modules/escalade/dist/index.js +0 -22
- package/node_modules/escalade/dist/index.mjs +0 -22
- package/node_modules/escalade/index.d.ts +0 -3
- package/node_modules/escalade/license +0 -9
- package/node_modules/escalade/package.json +0 -96
- package/node_modules/escalade/readme.md +0 -211
- package/node_modules/escalade/sync/index.d.ts +0 -2
- package/node_modules/escalade/sync/index.js +0 -18
- package/node_modules/escalade/sync/index.mjs +0 -18
- package/node_modules/fast-safe-stringify/.travis.yml +0 -8
- package/node_modules/fast-safe-stringify/CHANGELOG.md +0 -17
- package/node_modules/fast-safe-stringify/LICENSE +0 -23
- package/node_modules/fast-safe-stringify/benchmark.js +0 -137
- package/node_modules/fast-safe-stringify/index.d.ts +0 -23
- package/node_modules/fast-safe-stringify/index.js +0 -229
- package/node_modules/fast-safe-stringify/package.json +0 -90
- package/node_modules/fast-safe-stringify/readme.md +0 -170
- package/node_modules/fast-safe-stringify/test-stable.js +0 -404
- package/node_modules/fast-safe-stringify/test.js +0 -397
- package/node_modules/fill-range/LICENSE +0 -21
- package/node_modules/fill-range/README.md +0 -237
- package/node_modules/fill-range/index.js +0 -249
- package/node_modules/fill-range/package.json +0 -117
- package/node_modules/follow-redirects/LICENSE +0 -18
- package/node_modules/follow-redirects/README.md +0 -155
- package/node_modules/follow-redirects/debug.js +0 -15
- package/node_modules/follow-redirects/http.js +0 -1
- package/node_modules/follow-redirects/https.js +0 -1
- package/node_modules/follow-redirects/index.js +0 -598
- package/node_modules/follow-redirects/package.json +0 -98
- package/node_modules/form-data/License +0 -19
- package/node_modules/form-data/README.md.bak +0 -358
- package/node_modules/form-data/Readme.md +0 -358
- package/node_modules/form-data/index.d.ts +0 -62
- package/node_modules/form-data/lib/browser.js +0 -2
- package/node_modules/form-data/lib/form_data.js +0 -501
- package/node_modules/form-data/lib/populate.js +0 -10
- package/node_modules/form-data/package.json +0 -104
- package/node_modules/formidable/LICENSE +0 -7
- package/node_modules/formidable/Readme.md +0 -448
- package/node_modules/formidable/lib/file.js +0 -81
- package/node_modules/formidable/lib/incoming_form.js +0 -564
- package/node_modules/formidable/lib/index.js +0 -3
- package/node_modules/formidable/lib/json_parser.js +0 -30
- package/node_modules/formidable/lib/multipart_parser.js +0 -332
- package/node_modules/formidable/lib/octet_parser.js +0 -20
- package/node_modules/formidable/lib/querystring_parser.js +0 -27
- package/node_modules/formidable/package.json +0 -63
- package/node_modules/fs-readdir-recursive/LICENSE +0 -22
- package/node_modules/fs-readdir-recursive/README.md +0 -61
- package/node_modules/fs-readdir-recursive/index.js +0 -29
- package/node_modules/fs-readdir-recursive/package.json +0 -60
- package/node_modules/fs.realpath/LICENSE +0 -43
- package/node_modules/fs.realpath/README.md +0 -33
- package/node_modules/fs.realpath/index.js +0 -66
- package/node_modules/fs.realpath/old.js +0 -303
- package/node_modules/fs.realpath/package.json +0 -62
- package/node_modules/function-bind/.editorconfig +0 -20
- package/node_modules/function-bind/.eslintrc +0 -15
- package/node_modules/function-bind/.jscs.json +0 -176
- package/node_modules/function-bind/.npmignore +0 -22
- package/node_modules/function-bind/.travis.yml +0 -168
- package/node_modules/function-bind/LICENSE +0 -20
- package/node_modules/function-bind/README.md +0 -48
- package/node_modules/function-bind/implementation.js +0 -52
- package/node_modules/function-bind/index.js +0 -5
- package/node_modules/function-bind/package.json +0 -100
- package/node_modules/function-bind/test/.eslintrc +0 -9
- package/node_modules/function-bind/test/index.js +0 -252
- package/node_modules/generate-password/.eslintrc.yml +0 -18
- package/node_modules/generate-password/.github/workflows/nodejs.yml +0 -33
- package/node_modules/generate-password/CHANGELOG.md +0 -79
- package/node_modules/generate-password/LICENSE +0 -21
- package/node_modules/generate-password/README.md +0 -61
- package/node_modules/generate-password/example.js +0 -28
- package/node_modules/generate-password/main.js +0 -1
- package/node_modules/generate-password/package.json +0 -68
- package/node_modules/generate-password/src/generate.d.ts +0 -51
- package/node_modules/generate-password/src/generate.js +0 -152
- package/node_modules/generate-password/test/coverage.sh +0 -17
- package/node_modules/generate-password/test/esm.mjs +0 -13
- package/node_modules/generate-password/test/generator.js +0 -164
- package/node_modules/get-caller-file/LICENSE.md +0 -6
- package/node_modules/get-caller-file/README.md +0 -41
- package/node_modules/get-caller-file/index.d.ts +0 -2
- package/node_modules/get-caller-file/index.js +0 -22
- package/node_modules/get-caller-file/index.js.map +0 -1
- package/node_modules/get-caller-file/package.json +0 -72
- package/node_modules/get-intrinsic/.eslintrc +0 -37
- package/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
- package/node_modules/get-intrinsic/.nycrc +0 -9
- package/node_modules/get-intrinsic/CHANGELOG.md +0 -91
- package/node_modules/get-intrinsic/LICENSE +0 -21
- package/node_modules/get-intrinsic/README.md +0 -71
- package/node_modules/get-intrinsic/index.js +0 -334
- package/node_modules/get-intrinsic/package.json +0 -125
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
- package/node_modules/glob/LICENSE +0 -21
- package/node_modules/glob/README.md +0 -378
- package/node_modules/glob/common.js +0 -238
- package/node_modules/glob/glob.js +0 -790
- package/node_modules/glob/package.json +0 -93
- package/node_modules/glob/sync.js +0 -486
- package/node_modules/glob-parent/CHANGELOG.md +0 -110
- package/node_modules/glob-parent/LICENSE +0 -15
- package/node_modules/glob-parent/README.md +0 -137
- package/node_modules/glob-parent/index.js +0 -42
- package/node_modules/glob-parent/package.json +0 -95
- package/node_modules/has/LICENSE-MIT +0 -22
- package/node_modules/has/README.md +0 -18
- package/node_modules/has/package.json +0 -81
- package/node_modules/has/src/index.js +0 -5
- package/node_modules/has/test/index.js +0 -10
- package/node_modules/has-symbols/.eslintrc +0 -11
- package/node_modules/has-symbols/.github/FUNDING.yml +0 -12
- package/node_modules/has-symbols/.nycrc +0 -9
- package/node_modules/has-symbols/CHANGELOG.md +0 -75
- package/node_modules/has-symbols/LICENSE +0 -21
- package/node_modules/has-symbols/README.md +0 -46
- package/node_modules/has-symbols/index.js +0 -13
- package/node_modules/has-symbols/package.json +0 -134
- package/node_modules/has-symbols/shams.js +0 -42
- package/node_modules/has-symbols/test/index.js +0 -22
- package/node_modules/has-symbols/test/shams/core-js.js +0 -28
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -28
- package/node_modules/has-symbols/test/tests.js +0 -56
- package/node_modules/inflight/LICENSE +0 -15
- package/node_modules/inflight/README.md +0 -37
- package/node_modules/inflight/inflight.js +0 -54
- package/node_modules/inflight/package.json +0 -61
- package/node_modules/inherits/LICENSE +0 -16
- package/node_modules/inherits/README.md +0 -42
- package/node_modules/inherits/inherits.js +0 -9
- package/node_modules/inherits/inherits_browser.js +0 -27
- package/node_modules/inherits/package.json +0 -70
- package/node_modules/is-binary-path/index.d.ts +0 -17
- package/node_modules/is-binary-path/index.js +0 -7
- package/node_modules/is-binary-path/license +0 -9
- package/node_modules/is-binary-path/package.json +0 -76
- package/node_modules/is-binary-path/readme.md +0 -34
- package/node_modules/is-extglob/LICENSE +0 -21
- package/node_modules/is-extglob/README.md +0 -107
- package/node_modules/is-extglob/index.js +0 -20
- package/node_modules/is-extglob/package.json +0 -103
- package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
- package/node_modules/is-fullwidth-code-point/index.js +0 -50
- package/node_modules/is-fullwidth-code-point/license +0 -9
- package/node_modules/is-fullwidth-code-point/package.json +0 -80
- package/node_modules/is-fullwidth-code-point/readme.md +0 -39
- package/node_modules/is-glob/LICENSE +0 -21
- package/node_modules/is-glob/README.md +0 -206
- package/node_modules/is-glob/index.js +0 -150
- package/node_modules/is-glob/package.json +0 -127
- package/node_modules/is-number/LICENSE +0 -21
- package/node_modules/is-number/README.md +0 -187
- package/node_modules/is-number/index.js +0 -18
- package/node_modules/is-number/package.json +0 -125
- package/node_modules/lru-cache/LICENSE +0 -15
- package/node_modules/lru-cache/README.md +0 -166
- package/node_modules/lru-cache/index.js +0 -334
- package/node_modules/lru-cache/package.json +0 -72
- package/node_modules/methods/HISTORY.md +0 -29
- package/node_modules/methods/LICENSE +0 -24
- package/node_modules/methods/README.md +0 -51
- package/node_modules/methods/index.js +0 -69
- package/node_modules/methods/package.json +0 -82
- package/node_modules/mime/CHANGELOG.md +0 -296
- package/node_modules/mime/LICENSE +0 -21
- package/node_modules/mime/Mime.js +0 -97
- package/node_modules/mime/README.md +0 -187
- package/node_modules/mime/cli.js +0 -46
- package/node_modules/mime/index.js +0 -4
- package/node_modules/mime/lite.js +0 -4
- package/node_modules/mime/package.json +0 -84
- package/node_modules/mime/types/other.js +0 -1
- package/node_modules/mime/types/standard.js +0 -1
- package/node_modules/mime-db/HISTORY.md +0 -507
- package/node_modules/mime-db/LICENSE +0 -23
- package/node_modules/mime-db/README.md +0 -100
- package/node_modules/mime-db/db.json +0 -8519
- package/node_modules/mime-db/index.js +0 -12
- package/node_modules/mime-db/package.json +0 -106
- package/node_modules/mime-types/HISTORY.md +0 -397
- package/node_modules/mime-types/LICENSE +0 -23
- package/node_modules/mime-types/README.md +0 -113
- package/node_modules/mime-types/index.js +0 -188
- package/node_modules/mime-types/package.json +0 -92
- package/node_modules/minimatch/LICENSE +0 -15
- package/node_modules/minimatch/README.md +0 -230
- package/node_modules/minimatch/minimatch.js +0 -947
- package/node_modules/minimatch/package.json +0 -73
- package/node_modules/ms/index.js +0 -162
- package/node_modules/ms/license.md +0 -21
- package/node_modules/ms/package.json +0 -75
- package/node_modules/ms/readme.md +0 -60
- package/node_modules/multi-progress/.gitattributes +0 -17
- package/node_modules/multi-progress/CHANGELOG.md +0 -56
- package/node_modules/multi-progress/LICENSE.txt +0 -21
- package/node_modules/multi-progress/multi-progress.js +0 -98
- package/node_modules/multi-progress/package.json +0 -58
- package/node_modules/multi-progress/readme.md +0 -33
- package/node_modules/normalize-path/LICENSE +0 -21
- package/node_modules/normalize-path/README.md +0 -127
- package/node_modules/normalize-path/index.js +0 -35
- package/node_modules/normalize-path/package.json +0 -119
- package/node_modules/object-inspect/.eslintrc +0 -53
- package/node_modules/object-inspect/.github/FUNDING.yml +0 -12
- package/node_modules/object-inspect/.nycrc +0 -13
- package/node_modules/object-inspect/CHANGELOG.md +0 -360
- package/node_modules/object-inspect/LICENSE +0 -21
- package/node_modules/object-inspect/example/all.js +0 -23
- package/node_modules/object-inspect/example/circular.js +0 -6
- package/node_modules/object-inspect/example/fn.js +0 -5
- package/node_modules/object-inspect/example/inspect.js +0 -10
- package/node_modules/object-inspect/index.js +0 -512
- package/node_modules/object-inspect/package-support.json +0 -20
- package/node_modules/object-inspect/package.json +0 -126
- package/node_modules/object-inspect/readme.markdown +0 -86
- package/node_modules/object-inspect/test/bigint.js +0 -58
- package/node_modules/object-inspect/test/browser/dom.js +0 -15
- package/node_modules/object-inspect/test/circular.js +0 -16
- package/node_modules/object-inspect/test/deep.js +0 -12
- package/node_modules/object-inspect/test/element.js +0 -53
- package/node_modules/object-inspect/test/err.js +0 -48
- package/node_modules/object-inspect/test/fakes.js +0 -29
- package/node_modules/object-inspect/test/fn.js +0 -76
- package/node_modules/object-inspect/test/has.js +0 -15
- package/node_modules/object-inspect/test/holes.js +0 -15
- package/node_modules/object-inspect/test/indent-option.js +0 -271
- package/node_modules/object-inspect/test/inspect.js +0 -139
- package/node_modules/object-inspect/test/lowbyte.js +0 -12
- package/node_modules/object-inspect/test/number.js +0 -58
- package/node_modules/object-inspect/test/quoteStyle.js +0 -17
- package/node_modules/object-inspect/test/toStringTag.js +0 -40
- package/node_modules/object-inspect/test/undef.js +0 -12
- package/node_modules/object-inspect/test/values.js +0 -211
- package/node_modules/object-inspect/test-core-js.js +0 -26
- package/node_modules/object-inspect/util.inspect.js +0 -1
- package/node_modules/once/LICENSE +0 -15
- package/node_modules/once/README.md +0 -79
- package/node_modules/once/once.js +0 -42
- package/node_modules/once/package.json +0 -74
- package/node_modules/path-is-absolute/index.js +0 -20
- package/node_modules/path-is-absolute/license +0 -21
- package/node_modules/path-is-absolute/package.json +0 -78
- package/node_modules/path-is-absolute/readme.md +0 -59
- package/node_modules/picomatch/CHANGELOG.md +0 -136
- package/node_modules/picomatch/LICENSE +0 -21
- package/node_modules/picomatch/README.md +0 -708
- package/node_modules/picomatch/index.js +0 -3
- package/node_modules/picomatch/lib/constants.js +0 -179
- package/node_modules/picomatch/lib/parse.js +0 -1091
- package/node_modules/picomatch/lib/picomatch.js +0 -342
- package/node_modules/picomatch/lib/scan.js +0 -391
- package/node_modules/picomatch/lib/utils.js +0 -64
- package/node_modules/picomatch/package.json +0 -117
- package/node_modules/progress/CHANGELOG.md +0 -115
- package/node_modules/progress/LICENSE +0 -22
- package/node_modules/progress/Makefile +0 -8
- package/node_modules/progress/Readme.md +0 -146
- package/node_modules/progress/index.js +0 -1
- package/node_modules/progress/lib/node-progress.js +0 -236
- package/node_modules/progress/package.json +0 -74
- package/node_modules/qs/.editorconfig +0 -43
- package/node_modules/qs/.eslintrc +0 -38
- package/node_modules/qs/.github/FUNDING.yml +0 -12
- package/node_modules/qs/.nycrc +0 -13
- package/node_modules/qs/CHANGELOG.md +0 -546
- package/node_modules/qs/LICENSE.md +0 -29
- package/node_modules/qs/README.md +0 -625
- package/node_modules/qs/dist/qs.js +0 -2054
- package/node_modules/qs/lib/formats.js +0 -23
- package/node_modules/qs/lib/index.js +0 -11
- package/node_modules/qs/lib/parse.js +0 -263
- package/node_modules/qs/lib/stringify.js +0 -326
- package/node_modules/qs/lib/utils.js +0 -252
- package/node_modules/qs/package.json +0 -108
- package/node_modules/qs/test/parse.js +0 -855
- package/node_modules/qs/test/stringify.js +0 -909
- package/node_modules/qs/test/utils.js +0 -136
- package/node_modules/readdirp/LICENSE +0 -21
- package/node_modules/readdirp/README.md +0 -122
- package/node_modules/readdirp/index.d.ts +0 -43
- package/node_modules/readdirp/index.js +0 -287
- package/node_modules/readdirp/package.json +0 -162
- package/node_modules/require-directory/.jshintrc +0 -67
- package/node_modules/require-directory/.npmignore +0 -1
- package/node_modules/require-directory/.travis.yml +0 -3
- package/node_modules/require-directory/LICENSE +0 -22
- package/node_modules/require-directory/README.markdown +0 -184
- package/node_modules/require-directory/index.js +0 -86
- package/node_modules/require-directory/package.json +0 -72
- package/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/safe-buffer/index.js +0 -62
- package/node_modules/safe-buffer/package.json +0 -69
- package/node_modules/semver/LICENSE +0 -15
- package/node_modules/semver/README.md +0 -568
- package/node_modules/semver/bin/semver.js +0 -183
- package/node_modules/semver/classes/comparator.js +0 -136
- package/node_modules/semver/classes/index.js +0 -5
- package/node_modules/semver/classes/range.js +0 -519
- package/node_modules/semver/classes/semver.js +0 -287
- package/node_modules/semver/functions/clean.js +0 -6
- package/node_modules/semver/functions/cmp.js +0 -52
- package/node_modules/semver/functions/coerce.js +0 -52
- package/node_modules/semver/functions/compare-build.js +0 -7
- package/node_modules/semver/functions/compare-loose.js +0 -3
- package/node_modules/semver/functions/compare.js +0 -5
- package/node_modules/semver/functions/diff.js +0 -23
- package/node_modules/semver/functions/eq.js +0 -3
- package/node_modules/semver/functions/gt.js +0 -3
- package/node_modules/semver/functions/gte.js +0 -3
- package/node_modules/semver/functions/inc.js +0 -18
- package/node_modules/semver/functions/lt.js +0 -3
- package/node_modules/semver/functions/lte.js +0 -3
- package/node_modules/semver/functions/major.js +0 -3
- package/node_modules/semver/functions/minor.js +0 -3
- package/node_modules/semver/functions/neq.js +0 -3
- package/node_modules/semver/functions/parse.js +0 -33
- package/node_modules/semver/functions/patch.js +0 -3
- package/node_modules/semver/functions/prerelease.js +0 -6
- package/node_modules/semver/functions/rcompare.js +0 -3
- package/node_modules/semver/functions/rsort.js +0 -3
- package/node_modules/semver/functions/satisfies.js +0 -10
- package/node_modules/semver/functions/sort.js +0 -3
- package/node_modules/semver/functions/valid.js +0 -6
- package/node_modules/semver/index.js +0 -48
- package/node_modules/semver/internal/constants.js +0 -17
- package/node_modules/semver/internal/debug.js +0 -9
- package/node_modules/semver/internal/identifiers.js +0 -23
- package/node_modules/semver/internal/parse-options.js +0 -11
- package/node_modules/semver/internal/re.js +0 -182
- package/node_modules/semver/package.json +0 -113
- package/node_modules/semver/preload.js +0 -2
- package/node_modules/semver/range.bnf +0 -16
- package/node_modules/semver/ranges/gtr.js +0 -4
- package/node_modules/semver/ranges/intersects.js +0 -7
- package/node_modules/semver/ranges/ltr.js +0 -4
- package/node_modules/semver/ranges/max-satisfying.js +0 -25
- package/node_modules/semver/ranges/min-satisfying.js +0 -24
- package/node_modules/semver/ranges/min-version.js +0 -61
- package/node_modules/semver/ranges/outside.js +0 -80
- package/node_modules/semver/ranges/simplify.js +0 -47
- package/node_modules/semver/ranges/subset.js +0 -244
- package/node_modules/semver/ranges/to-comparators.js +0 -8
- package/node_modules/semver/ranges/valid.js +0 -11
- package/node_modules/side-channel/.eslintignore +0 -1
- package/node_modules/side-channel/.eslintrc +0 -11
- package/node_modules/side-channel/.github/FUNDING.yml +0 -12
- package/node_modules/side-channel/.nycrc +0 -13
- package/node_modules/side-channel/CHANGELOG.md +0 -65
- package/node_modules/side-channel/LICENSE +0 -21
- package/node_modules/side-channel/README.md +0 -2
- package/node_modules/side-channel/index.js +0 -124
- package/node_modules/side-channel/package.json +0 -99
- package/node_modules/side-channel/test/index.js +0 -78
- package/node_modules/string-width/index.d.ts +0 -29
- package/node_modules/string-width/index.js +0 -47
- package/node_modules/string-width/license +0 -9
- package/node_modules/string-width/package.json +0 -98
- package/node_modules/string-width/readme.md +0 -50
- package/node_modules/string_decoder/.travis.yml +0 -50
- package/node_modules/string_decoder/LICENSE +0 -48
- package/node_modules/string_decoder/README.md +0 -47
- package/node_modules/string_decoder/lib/string_decoder.js +0 -296
- package/node_modules/string_decoder/package.json +0 -64
- package/node_modules/strip-ansi/index.d.ts +0 -17
- package/node_modules/strip-ansi/index.js +0 -4
- package/node_modules/strip-ansi/license +0 -9
- package/node_modules/strip-ansi/package.json +0 -95
- package/node_modules/strip-ansi/readme.md +0 -46
- package/node_modules/superagent/.browserslistrc +0 -5
- package/node_modules/superagent/.dist.babelrc +0 -10
- package/node_modules/superagent/.dist.eslintrc +0 -35
- package/node_modules/superagent/.editorconfig +0 -9
- package/node_modules/superagent/.gitattributes +0 -1
- package/node_modules/superagent/.lib.babelrc +0 -11
- package/node_modules/superagent/.lib.eslintrc +0 -24
- package/node_modules/superagent/.remarkignore +0 -3
- package/node_modules/superagent/.zuul.yml +0 -16
- package/node_modules/superagent/CONTRIBUTING.md +0 -7
- package/node_modules/superagent/HISTORY.md +0 -692
- package/node_modules/superagent/LICENSE +0 -22
- package/node_modules/superagent/Makefile +0 -60
- package/node_modules/superagent/README.md +0 -266
- package/node_modules/superagent/dist/superagent.js +0 -2418
- package/node_modules/superagent/dist/superagent.min.js +0 -1
- package/node_modules/superagent/docs/head.html +0 -11
- package/node_modules/superagent/docs/images/bg.png +0 -0
- package/node_modules/superagent/docs/index.md +0 -736
- package/node_modules/superagent/docs/style.css +0 -87
- package/node_modules/superagent/docs/tail.html +0 -36
- package/node_modules/superagent/docs/test.html +0 -5072
- package/node_modules/superagent/index.html +0 -47
- package/node_modules/superagent/lib/agent-base.js +0 -42
- package/node_modules/superagent/lib/client.js +0 -1020
- package/node_modules/superagent/lib/is-object.js +0 -17
- package/node_modules/superagent/lib/node/agent.js +0 -113
- package/node_modules/superagent/lib/node/http2wrapper.js +0 -218
- package/node_modules/superagent/lib/node/index.js +0 -1376
- package/node_modules/superagent/lib/node/parsers/image.js +0 -13
- package/node_modules/superagent/lib/node/parsers/index.js +0 -12
- package/node_modules/superagent/lib/node/parsers/json.js +0 -26
- package/node_modules/superagent/lib/node/parsers/text.js +0 -11
- package/node_modules/superagent/lib/node/parsers/urlencoded.js +0 -22
- package/node_modules/superagent/lib/node/response.js +0 -126
- package/node_modules/superagent/lib/node/unzip.js +0 -72
- package/node_modules/superagent/lib/request-base.js +0 -757
- package/node_modules/superagent/lib/response-base.js +0 -131
- package/node_modules/superagent/lib/utils.js +0 -71
- package/node_modules/superagent/node_modules/form-data/License +0 -19
- package/node_modules/superagent/node_modules/form-data/README.md.bak +0 -356
- package/node_modules/superagent/node_modules/form-data/Readme.md +0 -356
- package/node_modules/superagent/node_modules/form-data/index.d.ts +0 -62
- package/node_modules/superagent/node_modules/form-data/lib/browser.js +0 -2
- package/node_modules/superagent/node_modules/form-data/lib/form_data.js +0 -498
- package/node_modules/superagent/node_modules/form-data/lib/populate.js +0 -10
- package/node_modules/superagent/node_modules/form-data/package.json +0 -104
- package/node_modules/superagent/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- package/node_modules/superagent/node_modules/readable-stream/GOVERNANCE.md +0 -136
- package/node_modules/superagent/node_modules/readable-stream/LICENSE +0 -47
- package/node_modules/superagent/node_modules/readable-stream/README.md +0 -106
- package/node_modules/superagent/node_modules/readable-stream/errors-browser.js +0 -127
- package/node_modules/superagent/node_modules/readable-stream/errors.js +0 -116
- package/node_modules/superagent/node_modules/readable-stream/experimentalWarning.js +0 -17
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_duplex.js +0 -139
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_passthrough.js +0 -39
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_readable.js +0 -1124
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_transform.js +0 -201
- package/node_modules/superagent/node_modules/readable-stream/lib/_stream_writable.js +0 -697
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -207
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -210
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -105
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -104
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -3
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/from.js +0 -64
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -97
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/state.js +0 -27
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- package/node_modules/superagent/node_modules/readable-stream/package.json +0 -100
- package/node_modules/superagent/node_modules/readable-stream/readable-browser.js +0 -9
- package/node_modules/superagent/node_modules/readable-stream/readable.js +0 -16
- package/node_modules/superagent/package.json +0 -272
- package/node_modules/to-regex-range/LICENSE +0 -21
- package/node_modules/to-regex-range/README.md +0 -305
- package/node_modules/to-regex-range/index.js +0 -288
- package/node_modules/to-regex-range/package.json +0 -128
- package/node_modules/util-deprecate/History.md +0 -16
- package/node_modules/util-deprecate/LICENSE +0 -24
- package/node_modules/util-deprecate/README.md +0 -53
- package/node_modules/util-deprecate/browser.js +0 -67
- package/node_modules/util-deprecate/node.js +0 -6
- package/node_modules/util-deprecate/package.json +0 -61
- package/node_modules/uuid/CHANGELOG.md +0 -229
- package/node_modules/uuid/CONTRIBUTING.md +0 -18
- package/node_modules/uuid/LICENSE.md +0 -9
- package/node_modules/uuid/README.md +0 -505
- package/node_modules/uuid/dist/bin/uuid +0 -2
- package/node_modules/uuid/dist/esm-browser/index.js +0 -9
- package/node_modules/uuid/dist/esm-browser/md5.js +0 -215
- package/node_modules/uuid/dist/esm-browser/nil.js +0 -1
- package/node_modules/uuid/dist/esm-browser/parse.js +0 -35
- package/node_modules/uuid/dist/esm-browser/regex.js +0 -1
- package/node_modules/uuid/dist/esm-browser/rng.js +0 -19
- package/node_modules/uuid/dist/esm-browser/sha1.js +0 -96
- package/node_modules/uuid/dist/esm-browser/stringify.js +0 -30
- package/node_modules/uuid/dist/esm-browser/v1.js +0 -95
- package/node_modules/uuid/dist/esm-browser/v3.js +0 -4
- package/node_modules/uuid/dist/esm-browser/v35.js +0 -64
- package/node_modules/uuid/dist/esm-browser/v4.js +0 -24
- package/node_modules/uuid/dist/esm-browser/v5.js +0 -4
- package/node_modules/uuid/dist/esm-browser/validate.js +0 -7
- package/node_modules/uuid/dist/esm-browser/version.js +0 -11
- package/node_modules/uuid/dist/esm-node/index.js +0 -9
- package/node_modules/uuid/dist/esm-node/md5.js +0 -13
- package/node_modules/uuid/dist/esm-node/nil.js +0 -1
- package/node_modules/uuid/dist/esm-node/parse.js +0 -35
- package/node_modules/uuid/dist/esm-node/regex.js +0 -1
- package/node_modules/uuid/dist/esm-node/rng.js +0 -12
- package/node_modules/uuid/dist/esm-node/sha1.js +0 -13
- package/node_modules/uuid/dist/esm-node/stringify.js +0 -29
- package/node_modules/uuid/dist/esm-node/v1.js +0 -95
- package/node_modules/uuid/dist/esm-node/v3.js +0 -4
- package/node_modules/uuid/dist/esm-node/v35.js +0 -64
- package/node_modules/uuid/dist/esm-node/v4.js +0 -24
- package/node_modules/uuid/dist/esm-node/v5.js +0 -4
- package/node_modules/uuid/dist/esm-node/validate.js +0 -7
- package/node_modules/uuid/dist/esm-node/version.js +0 -11
- package/node_modules/uuid/dist/index.js +0 -79
- package/node_modules/uuid/dist/md5-browser.js +0 -223
- package/node_modules/uuid/dist/md5.js +0 -23
- package/node_modules/uuid/dist/nil.js +0 -8
- package/node_modules/uuid/dist/parse.js +0 -45
- package/node_modules/uuid/dist/regex.js +0 -8
- package/node_modules/uuid/dist/rng-browser.js +0 -26
- package/node_modules/uuid/dist/rng.js +0 -24
- package/node_modules/uuid/dist/sha1-browser.js +0 -104
- package/node_modules/uuid/dist/sha1.js +0 -23
- package/node_modules/uuid/dist/stringify.js +0 -39
- package/node_modules/uuid/dist/umd/uuid.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidNIL.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidParse.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidStringify.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidValidate.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidVersion.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv1.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv3.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv4.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv5.min.js +0 -1
- package/node_modules/uuid/dist/uuid-bin.js +0 -85
- package/node_modules/uuid/dist/v1.js +0 -107
- package/node_modules/uuid/dist/v3.js +0 -16
- package/node_modules/uuid/dist/v35.js +0 -78
- package/node_modules/uuid/dist/v4.js +0 -37
- package/node_modules/uuid/dist/v5.js +0 -16
- package/node_modules/uuid/dist/validate.js +0 -17
- package/node_modules/uuid/dist/version.js +0 -21
- package/node_modules/uuid/package.json +0 -167
- package/node_modules/uuid/wrapper.mjs +0 -10
- package/node_modules/wrap-ansi/index.js +0 -216
- package/node_modules/wrap-ansi/license +0 -9
- package/node_modules/wrap-ansi/package.json +0 -98
- package/node_modules/wrap-ansi/readme.md +0 -91
- package/node_modules/wrappy/LICENSE +0 -15
- package/node_modules/wrappy/README.md +0 -36
- package/node_modules/wrappy/package.json +0 -62
- package/node_modules/wrappy/wrappy.js +0 -33
- package/node_modules/y18n/CHANGELOG.md +0 -100
- package/node_modules/y18n/LICENSE +0 -13
- package/node_modules/y18n/README.md +0 -127
- package/node_modules/y18n/build/index.cjs +0 -203
- package/node_modules/y18n/build/lib/cjs.js +0 -6
- package/node_modules/y18n/build/lib/index.js +0 -174
- package/node_modules/y18n/build/lib/platform-shims/node.js +0 -19
- package/node_modules/y18n/index.mjs +0 -8
- package/node_modules/y18n/package.json +0 -104
- package/node_modules/yallist/LICENSE +0 -15
- package/node_modules/yallist/README.md +0 -204
- package/node_modules/yallist/iterator.js +0 -8
- package/node_modules/yallist/package.json +0 -68
- package/node_modules/yallist/yallist.js +0 -426
- package/node_modules/yargs/LICENSE +0 -21
- package/node_modules/yargs/README.md +0 -204
- package/node_modules/yargs/browser.mjs +0 -7
- package/node_modules/yargs/build/index.cjs +0 -1
- package/node_modules/yargs/build/lib/argsert.js +0 -62
- package/node_modules/yargs/build/lib/command.js +0 -447
- package/node_modules/yargs/build/lib/completion-templates.js +0 -48
- package/node_modules/yargs/build/lib/completion.js +0 -236
- package/node_modules/yargs/build/lib/middleware.js +0 -88
- package/node_modules/yargs/build/lib/parse-command.js +0 -32
- package/node_modules/yargs/build/lib/typings/common-types.js +0 -9
- package/node_modules/yargs/build/lib/typings/yargs-parser-types.js +0 -1
- package/node_modules/yargs/build/lib/usage.js +0 -579
- package/node_modules/yargs/build/lib/utils/apply-extends.js +0 -59
- package/node_modules/yargs/build/lib/utils/is-promise.js +0 -5
- package/node_modules/yargs/build/lib/utils/levenshtein.js +0 -34
- package/node_modules/yargs/build/lib/utils/maybe-async-result.js +0 -17
- package/node_modules/yargs/build/lib/utils/obj-filter.js +0 -10
- package/node_modules/yargs/build/lib/utils/process-argv.js +0 -17
- package/node_modules/yargs/build/lib/utils/set-blocking.js +0 -12
- package/node_modules/yargs/build/lib/utils/which-module.js +0 -10
- package/node_modules/yargs/build/lib/validation.js +0 -305
- package/node_modules/yargs/build/lib/yargs-factory.js +0 -1497
- package/node_modules/yargs/build/lib/yerror.js +0 -9
- package/node_modules/yargs/helpers/helpers.mjs +0 -10
- package/node_modules/yargs/helpers/index.js +0 -14
- package/node_modules/yargs/helpers/package.json +0 -3
- package/node_modules/yargs/index.cjs +0 -53
- package/node_modules/yargs/index.mjs +0 -8
- package/node_modules/yargs/lib/platform-shims/browser.mjs +0 -95
- package/node_modules/yargs/lib/platform-shims/esm.mjs +0 -73
- package/node_modules/yargs/locales/be.json +0 -46
- package/node_modules/yargs/locales/de.json +0 -46
- package/node_modules/yargs/locales/en.json +0 -51
- package/node_modules/yargs/locales/es.json +0 -46
- package/node_modules/yargs/locales/fi.json +0 -49
- package/node_modules/yargs/locales/fr.json +0 -53
- package/node_modules/yargs/locales/hi.json +0 -49
- package/node_modules/yargs/locales/hu.json +0 -46
- package/node_modules/yargs/locales/id.json +0 -50
- package/node_modules/yargs/locales/it.json +0 -46
- package/node_modules/yargs/locales/ja.json +0 -51
- package/node_modules/yargs/locales/ko.json +0 -49
- package/node_modules/yargs/locales/nb.json +0 -44
- package/node_modules/yargs/locales/nl.json +0 -49
- package/node_modules/yargs/locales/nn.json +0 -44
- package/node_modules/yargs/locales/pirate.json +0 -13
- package/node_modules/yargs/locales/pl.json +0 -49
- package/node_modules/yargs/locales/pt.json +0 -45
- package/node_modules/yargs/locales/pt_BR.json +0 -48
- package/node_modules/yargs/locales/ru.json +0 -51
- package/node_modules/yargs/locales/th.json +0 -46
- package/node_modules/yargs/locales/tr.json +0 -48
- package/node_modules/yargs/locales/uk_UA.json +0 -51
- package/node_modules/yargs/locales/uz.json +0 -52
- package/node_modules/yargs/locales/zh_CN.json +0 -48
- package/node_modules/yargs/locales/zh_TW.json +0 -51
- package/node_modules/yargs/package.json +0 -154
- package/node_modules/yargs/yargs +0 -9
- package/node_modules/yargs/yargs.mjs +0 -10
- package/node_modules/yargs-parser/CHANGELOG.md +0 -287
- package/node_modules/yargs-parser/LICENSE.txt +0 -14
- package/node_modules/yargs-parser/README.md +0 -518
- package/node_modules/yargs-parser/browser.js +0 -29
- package/node_modules/yargs-parser/build/index.cjs +0 -1048
- package/node_modules/yargs-parser/build/lib/index.js +0 -60
- package/node_modules/yargs-parser/build/lib/string-utils.js +0 -65
- package/node_modules/yargs-parser/build/lib/tokenize-arg-string.js +0 -40
- package/node_modules/yargs-parser/build/lib/yargs-parser-types.js +0 -12
- package/node_modules/yargs-parser/build/lib/yargs-parser.js +0 -1045
- package/node_modules/yargs-parser/package.json +0 -123
- package/src/clients/TrialAccount.js +0 -76
- package/src/commands/agent/index.js +0 -27
- package/src/commands/signup.js +0 -104
- package/test.sh +0 -2
- /package/src/commands/{agent → instances}/apps/install.js +0 -0
- /package/src/commands/{agent → instances}/ready.js +0 -0
@@ -1,1649 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Module dependencies.
|
3
|
-
*/
|
4
|
-
|
5
|
-
var EventEmitter = require('events').EventEmitter;
|
6
|
-
var spawn = require('child_process').spawn;
|
7
|
-
var path = require('path');
|
8
|
-
var dirname = path.dirname;
|
9
|
-
var basename = path.basename;
|
10
|
-
var fs = require('fs');
|
11
|
-
|
12
|
-
/**
|
13
|
-
* Inherit `Command` from `EventEmitter.prototype`.
|
14
|
-
*/
|
15
|
-
|
16
|
-
require('util').inherits(Command, EventEmitter);
|
17
|
-
|
18
|
-
/**
|
19
|
-
* Expose the root command.
|
20
|
-
*/
|
21
|
-
|
22
|
-
exports = module.exports = new Command();
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Expose `Command`.
|
26
|
-
*/
|
27
|
-
|
28
|
-
exports.Command = Command;
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Expose `Option`.
|
32
|
-
*/
|
33
|
-
|
34
|
-
exports.Option = Option;
|
35
|
-
|
36
|
-
/**
|
37
|
-
* Initialize a new `Option` with the given `flags` and `description`.
|
38
|
-
*
|
39
|
-
* @param {String} flags
|
40
|
-
* @param {String} description
|
41
|
-
* @api public
|
42
|
-
*/
|
43
|
-
|
44
|
-
function Option(flags, description) {
|
45
|
-
this.flags = flags;
|
46
|
-
this.required = flags.indexOf('<') >= 0; // A value must be supplied when the option is specified.
|
47
|
-
this.optional = flags.indexOf('[') >= 0; // A value is optional when the option is specified.
|
48
|
-
this.mandatory = false; // The option must have a value after parsing, which usually means it must be specified on command line.
|
49
|
-
this.negate = flags.indexOf('-no-') !== -1;
|
50
|
-
flags = flags.split(/[ ,|]+/);
|
51
|
-
if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();
|
52
|
-
this.long = flags.shift();
|
53
|
-
this.description = description || '';
|
54
|
-
}
|
55
|
-
|
56
|
-
/**
|
57
|
-
* Return option name.
|
58
|
-
*
|
59
|
-
* @return {String}
|
60
|
-
* @api private
|
61
|
-
*/
|
62
|
-
|
63
|
-
Option.prototype.name = function() {
|
64
|
-
return this.long.replace(/^--/, '');
|
65
|
-
};
|
66
|
-
|
67
|
-
/**
|
68
|
-
* Return option name, in a camelcase format that can be used
|
69
|
-
* as a object attribute key.
|
70
|
-
*
|
71
|
-
* @return {String}
|
72
|
-
* @api private
|
73
|
-
*/
|
74
|
-
|
75
|
-
Option.prototype.attributeName = function() {
|
76
|
-
return camelcase(this.name().replace(/^no-/, ''));
|
77
|
-
};
|
78
|
-
|
79
|
-
/**
|
80
|
-
* Check if `arg` matches the short or long flag.
|
81
|
-
*
|
82
|
-
* @param {String} arg
|
83
|
-
* @return {Boolean}
|
84
|
-
* @api private
|
85
|
-
*/
|
86
|
-
|
87
|
-
Option.prototype.is = function(arg) {
|
88
|
-
return this.short === arg || this.long === arg;
|
89
|
-
};
|
90
|
-
|
91
|
-
/**
|
92
|
-
* CommanderError class
|
93
|
-
* @class
|
94
|
-
*/
|
95
|
-
class CommanderError extends Error {
|
96
|
-
/**
|
97
|
-
* Constructs the CommanderError class
|
98
|
-
* @param {Number} exitCode suggested exit code which could be used with process.exit
|
99
|
-
* @param {String} code an id string representing the error
|
100
|
-
* @param {String} message human-readable description of the error
|
101
|
-
* @constructor
|
102
|
-
*/
|
103
|
-
constructor(exitCode, code, message) {
|
104
|
-
super(message);
|
105
|
-
// properly capture stack trace in Node.js
|
106
|
-
Error.captureStackTrace(this, this.constructor);
|
107
|
-
this.name = this.constructor.name;
|
108
|
-
this.code = code;
|
109
|
-
this.exitCode = exitCode;
|
110
|
-
}
|
111
|
-
}
|
112
|
-
|
113
|
-
exports.CommanderError = CommanderError;
|
114
|
-
|
115
|
-
/**
|
116
|
-
* Initialize a new `Command`.
|
117
|
-
*
|
118
|
-
* @param {String} [name]
|
119
|
-
* @api public
|
120
|
-
*/
|
121
|
-
|
122
|
-
function Command(name) {
|
123
|
-
this.commands = [];
|
124
|
-
this.options = [];
|
125
|
-
this._execs = new Set();
|
126
|
-
this._allowUnknownOption = false;
|
127
|
-
this._args = [];
|
128
|
-
this._name = name || '';
|
129
|
-
this._optionValues = {};
|
130
|
-
this._storeOptionsAsProperties = true; // backwards compatible by default
|
131
|
-
this._passCommandToAction = true; // backwards compatible by default
|
132
|
-
this._actionResults = [];
|
133
|
-
|
134
|
-
this._helpFlags = '-h, --help';
|
135
|
-
this._helpDescription = 'output usage information';
|
136
|
-
this._helpShortFlag = '-h';
|
137
|
-
this._helpLongFlag = '--help';
|
138
|
-
}
|
139
|
-
|
140
|
-
/**
|
141
|
-
* Define a command.
|
142
|
-
*
|
143
|
-
* There are two styles of command: pay attention to where to put the description.
|
144
|
-
*
|
145
|
-
* Examples:
|
146
|
-
*
|
147
|
-
* // Command implemented using action handler (description is supplied separately to `.command`)
|
148
|
-
* program
|
149
|
-
* .command('clone <source> [destination]')
|
150
|
-
* .description('clone a repository into a newly created directory')
|
151
|
-
* .action((source, destination) => {
|
152
|
-
* console.log('clone command called');
|
153
|
-
* });
|
154
|
-
*
|
155
|
-
* // Command implemented using separate executable file (description is second parameter to `.command`)
|
156
|
-
* program
|
157
|
-
* .command('start <service>', 'start named service')
|
158
|
-
* .command('stop [service]', 'stop named service, or all if no name supplied');
|
159
|
-
*
|
160
|
-
* @param {string} nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
|
161
|
-
* @param {Object|string} [actionOptsOrExecDesc] - configuration options (for action), or description (for executable)
|
162
|
-
* @param {Object} [execOpts] - configuration options (for executable)
|
163
|
-
* @return {Command} returns new command for action handler, or top-level command for executable command
|
164
|
-
* @api public
|
165
|
-
*/
|
166
|
-
|
167
|
-
Command.prototype.command = function(nameAndArgs, actionOptsOrExecDesc, execOpts) {
|
168
|
-
var desc = actionOptsOrExecDesc;
|
169
|
-
var opts = execOpts;
|
170
|
-
if (typeof desc === 'object' && desc !== null) {
|
171
|
-
opts = desc;
|
172
|
-
desc = null;
|
173
|
-
}
|
174
|
-
opts = opts || {};
|
175
|
-
var args = nameAndArgs.split(/ +/);
|
176
|
-
var cmd = new Command(args.shift());
|
177
|
-
|
178
|
-
if (desc) {
|
179
|
-
cmd.description(desc);
|
180
|
-
this.executables = true;
|
181
|
-
this._execs.add(cmd._name);
|
182
|
-
if (opts.isDefault) this.defaultExecutable = cmd._name;
|
183
|
-
}
|
184
|
-
cmd._noHelp = !!opts.noHelp;
|
185
|
-
cmd._helpFlags = this._helpFlags;
|
186
|
-
cmd._helpDescription = this._helpDescription;
|
187
|
-
cmd._helpShortFlag = this._helpShortFlag;
|
188
|
-
cmd._helpLongFlag = this._helpLongFlag;
|
189
|
-
cmd._exitCallback = this._exitCallback;
|
190
|
-
cmd._storeOptionsAsProperties = this._storeOptionsAsProperties;
|
191
|
-
cmd._passCommandToAction = this._passCommandToAction;
|
192
|
-
|
193
|
-
cmd._executableFile = opts.executableFile; // Custom name for executable file
|
194
|
-
this.commands.push(cmd);
|
195
|
-
cmd.parseExpectedArgs(args);
|
196
|
-
cmd.parent = this;
|
197
|
-
|
198
|
-
if (desc) return this;
|
199
|
-
return cmd;
|
200
|
-
};
|
201
|
-
|
202
|
-
/**
|
203
|
-
* Define argument syntax for the top-level command.
|
204
|
-
*
|
205
|
-
* @api public
|
206
|
-
*/
|
207
|
-
|
208
|
-
Command.prototype.arguments = function(desc) {
|
209
|
-
return this.parseExpectedArgs(desc.split(/ +/));
|
210
|
-
};
|
211
|
-
|
212
|
-
/**
|
213
|
-
* Add an implicit `help [cmd]` subcommand
|
214
|
-
* which invokes `--help` for the given command.
|
215
|
-
*
|
216
|
-
* @api private
|
217
|
-
*/
|
218
|
-
|
219
|
-
Command.prototype.addImplicitHelpCommand = function() {
|
220
|
-
this.command('help [cmd]', 'display help for [cmd]');
|
221
|
-
};
|
222
|
-
|
223
|
-
/**
|
224
|
-
* Parse expected `args`.
|
225
|
-
*
|
226
|
-
* For example `["[type]"]` becomes `[{ required: false, name: 'type' }]`.
|
227
|
-
*
|
228
|
-
* @param {Array} args
|
229
|
-
* @return {Command} for chaining
|
230
|
-
* @api public
|
231
|
-
*/
|
232
|
-
|
233
|
-
Command.prototype.parseExpectedArgs = function(args) {
|
234
|
-
if (!args.length) return;
|
235
|
-
var self = this;
|
236
|
-
args.forEach(function(arg) {
|
237
|
-
var argDetails = {
|
238
|
-
required: false,
|
239
|
-
name: '',
|
240
|
-
variadic: false
|
241
|
-
};
|
242
|
-
|
243
|
-
switch (arg[0]) {
|
244
|
-
case '<':
|
245
|
-
argDetails.required = true;
|
246
|
-
argDetails.name = arg.slice(1, -1);
|
247
|
-
break;
|
248
|
-
case '[':
|
249
|
-
argDetails.name = arg.slice(1, -1);
|
250
|
-
break;
|
251
|
-
}
|
252
|
-
|
253
|
-
if (argDetails.name.length > 3 && argDetails.name.slice(-3) === '...') {
|
254
|
-
argDetails.variadic = true;
|
255
|
-
argDetails.name = argDetails.name.slice(0, -3);
|
256
|
-
}
|
257
|
-
if (argDetails.name) {
|
258
|
-
self._args.push(argDetails);
|
259
|
-
}
|
260
|
-
});
|
261
|
-
return this;
|
262
|
-
};
|
263
|
-
|
264
|
-
/**
|
265
|
-
* Register callback to use as replacement for calling process.exit.
|
266
|
-
*
|
267
|
-
* @param {Function} [fn] optional callback which will be passed a CommanderError, defaults to throwing
|
268
|
-
* @return {Command} for chaining
|
269
|
-
* @api public
|
270
|
-
*/
|
271
|
-
|
272
|
-
Command.prototype.exitOverride = function(fn) {
|
273
|
-
if (fn) {
|
274
|
-
this._exitCallback = fn;
|
275
|
-
} else {
|
276
|
-
this._exitCallback = function(err) {
|
277
|
-
if (err.code !== 'commander.executeSubCommandAsync') {
|
278
|
-
throw err;
|
279
|
-
} else {
|
280
|
-
// Async callback from spawn events, not useful to throw.
|
281
|
-
}
|
282
|
-
};
|
283
|
-
}
|
284
|
-
return this;
|
285
|
-
};
|
286
|
-
|
287
|
-
/**
|
288
|
-
* Call process.exit, and _exitCallback if defined.
|
289
|
-
*
|
290
|
-
* @param {Number} exitCode exit code for using with process.exit
|
291
|
-
* @param {String} code an id string representing the error
|
292
|
-
* @param {String} message human-readable description of the error
|
293
|
-
* @return never
|
294
|
-
* @api private
|
295
|
-
*/
|
296
|
-
|
297
|
-
Command.prototype._exit = function(exitCode, code, message) {
|
298
|
-
if (this._exitCallback) {
|
299
|
-
this._exitCallback(new CommanderError(exitCode, code, message));
|
300
|
-
// Expecting this line is not reached.
|
301
|
-
}
|
302
|
-
process.exit(exitCode);
|
303
|
-
};
|
304
|
-
|
305
|
-
/**
|
306
|
-
* Register callback `fn` for the command.
|
307
|
-
*
|
308
|
-
* Examples:
|
309
|
-
*
|
310
|
-
* program
|
311
|
-
* .command('help')
|
312
|
-
* .description('display verbose help')
|
313
|
-
* .action(function() {
|
314
|
-
* // output help here
|
315
|
-
* });
|
316
|
-
*
|
317
|
-
* @param {Function} fn
|
318
|
-
* @return {Command} for chaining
|
319
|
-
* @api public
|
320
|
-
*/
|
321
|
-
|
322
|
-
Command.prototype.action = function(fn) {
|
323
|
-
var self = this;
|
324
|
-
var listener = function(args, unknown) {
|
325
|
-
// Parse any so-far unknown options
|
326
|
-
args = args || [];
|
327
|
-
unknown = unknown || [];
|
328
|
-
|
329
|
-
var parsed = self.parseOptions(unknown);
|
330
|
-
|
331
|
-
// Output help if necessary
|
332
|
-
outputHelpIfRequested(self, parsed.unknown);
|
333
|
-
self._checkForMissingMandatoryOptions();
|
334
|
-
|
335
|
-
// If there are still any unknown options, then we simply
|
336
|
-
// die, unless someone asked for help, in which case we give it
|
337
|
-
// to them, and then we die.
|
338
|
-
if (parsed.unknown.length > 0) {
|
339
|
-
self.unknownOption(parsed.unknown[0]);
|
340
|
-
}
|
341
|
-
|
342
|
-
// Leftover arguments need to be pushed back. Fixes issue #56
|
343
|
-
if (parsed.args.length) args = parsed.args.concat(args);
|
344
|
-
|
345
|
-
self._args.forEach(function(arg, i) {
|
346
|
-
if (arg.required && args[i] == null) {
|
347
|
-
self.missingArgument(arg.name);
|
348
|
-
} else if (arg.variadic) {
|
349
|
-
if (i !== self._args.length - 1) {
|
350
|
-
self.variadicArgNotLast(arg.name);
|
351
|
-
}
|
352
|
-
|
353
|
-
args[i] = args.splice(i);
|
354
|
-
}
|
355
|
-
});
|
356
|
-
|
357
|
-
// The .action callback takes an extra parameter which is the command itself.
|
358
|
-
var expectedArgsCount = self._args.length;
|
359
|
-
var actionArgs = args.slice(0, expectedArgsCount);
|
360
|
-
if (self._passCommandToAction) {
|
361
|
-
actionArgs[expectedArgsCount] = self;
|
362
|
-
} else {
|
363
|
-
actionArgs[expectedArgsCount] = self.opts();
|
364
|
-
}
|
365
|
-
// Add the extra arguments so available too.
|
366
|
-
if (args.length > expectedArgsCount) {
|
367
|
-
actionArgs.push(args.slice(expectedArgsCount));
|
368
|
-
}
|
369
|
-
|
370
|
-
const actionResult = fn.apply(self, actionArgs);
|
371
|
-
// Remember result in case it is async. Assume parseAsync getting called on root.
|
372
|
-
let rootCommand = self;
|
373
|
-
while (rootCommand.parent) {
|
374
|
-
rootCommand = rootCommand.parent;
|
375
|
-
}
|
376
|
-
rootCommand._actionResults.push(actionResult);
|
377
|
-
};
|
378
|
-
var parent = this.parent || this;
|
379
|
-
var name = parent === this ? '*' : this._name;
|
380
|
-
parent.on('command:' + name, listener);
|
381
|
-
if (this._alias) parent.on('command:' + this._alias, listener);
|
382
|
-
return this;
|
383
|
-
};
|
384
|
-
|
385
|
-
/**
|
386
|
-
* Internal implementation shared by .option() and .requiredOption()
|
387
|
-
*
|
388
|
-
* @param {Object} config
|
389
|
-
* @param {String} flags
|
390
|
-
* @param {String} description
|
391
|
-
* @param {Function|*} [fn] - custom option processing function or default vaue
|
392
|
-
* @param {*} [defaultValue]
|
393
|
-
* @return {Command} for chaining
|
394
|
-
* @api private
|
395
|
-
*/
|
396
|
-
|
397
|
-
Command.prototype._optionEx = function(config, flags, description, fn, defaultValue) {
|
398
|
-
var self = this,
|
399
|
-
option = new Option(flags, description),
|
400
|
-
oname = option.name(),
|
401
|
-
name = option.attributeName();
|
402
|
-
option.mandatory = !!config.mandatory;
|
403
|
-
|
404
|
-
// default as 3rd arg
|
405
|
-
if (typeof fn !== 'function') {
|
406
|
-
if (fn instanceof RegExp) {
|
407
|
-
// This is a bit simplistic (especially no error messages), and probably better handled by caller using custom option processing.
|
408
|
-
// No longer documented in README, but still present for backwards compatibility.
|
409
|
-
var regex = fn;
|
410
|
-
fn = function(val, def) {
|
411
|
-
var m = regex.exec(val);
|
412
|
-
return m ? m[0] : def;
|
413
|
-
};
|
414
|
-
} else {
|
415
|
-
defaultValue = fn;
|
416
|
-
fn = null;
|
417
|
-
}
|
418
|
-
}
|
419
|
-
|
420
|
-
// preassign default value for --no-*, [optional], <required>, or plain flag if boolean value
|
421
|
-
if (option.negate || option.optional || option.required || typeof defaultValue === 'boolean') {
|
422
|
-
// when --no-foo we make sure default is true, unless a --foo option is already defined
|
423
|
-
if (option.negate) {
|
424
|
-
const positiveLongFlag = option.long.replace(/^--no-/, '--');
|
425
|
-
defaultValue = self.optionFor(positiveLongFlag) ? self._getOptionValue(name) : true;
|
426
|
-
}
|
427
|
-
// preassign only if we have a default
|
428
|
-
if (defaultValue !== undefined) {
|
429
|
-
self._setOptionValue(name, defaultValue);
|
430
|
-
option.defaultValue = defaultValue;
|
431
|
-
}
|
432
|
-
}
|
433
|
-
|
434
|
-
// register the option
|
435
|
-
this.options.push(option);
|
436
|
-
|
437
|
-
// when it's passed assign the value
|
438
|
-
// and conditionally invoke the callback
|
439
|
-
this.on('option:' + oname, function(val) {
|
440
|
-
// coercion
|
441
|
-
if (val !== null && fn) {
|
442
|
-
val = fn(val, self._getOptionValue(name) === undefined ? defaultValue : self._getOptionValue(name));
|
443
|
-
}
|
444
|
-
|
445
|
-
// unassigned or boolean value
|
446
|
-
if (typeof self._getOptionValue(name) === 'boolean' || typeof self._getOptionValue(name) === 'undefined') {
|
447
|
-
// if no value, negate false, and we have a default, then use it!
|
448
|
-
if (val == null) {
|
449
|
-
self._setOptionValue(name, option.negate
|
450
|
-
? false
|
451
|
-
: defaultValue || true);
|
452
|
-
} else {
|
453
|
-
self._setOptionValue(name, val);
|
454
|
-
}
|
455
|
-
} else if (val !== null) {
|
456
|
-
// reassign
|
457
|
-
self._setOptionValue(name, option.negate ? false : val);
|
458
|
-
}
|
459
|
-
});
|
460
|
-
|
461
|
-
return this;
|
462
|
-
};
|
463
|
-
|
464
|
-
/**
|
465
|
-
* Define option with `flags`, `description` and optional
|
466
|
-
* coercion `fn`.
|
467
|
-
*
|
468
|
-
* The `flags` string should contain both the short and long flags,
|
469
|
-
* separated by comma, a pipe or space. The following are all valid
|
470
|
-
* all will output this way when `--help` is used.
|
471
|
-
*
|
472
|
-
* "-p, --pepper"
|
473
|
-
* "-p|--pepper"
|
474
|
-
* "-p --pepper"
|
475
|
-
*
|
476
|
-
* Examples:
|
477
|
-
*
|
478
|
-
* // simple boolean defaulting to undefined
|
479
|
-
* program.option('-p, --pepper', 'add pepper');
|
480
|
-
*
|
481
|
-
* program.pepper
|
482
|
-
* // => undefined
|
483
|
-
*
|
484
|
-
* --pepper
|
485
|
-
* program.pepper
|
486
|
-
* // => true
|
487
|
-
*
|
488
|
-
* // simple boolean defaulting to true (unless non-negated option is also defined)
|
489
|
-
* program.option('-C, --no-cheese', 'remove cheese');
|
490
|
-
*
|
491
|
-
* program.cheese
|
492
|
-
* // => true
|
493
|
-
*
|
494
|
-
* --no-cheese
|
495
|
-
* program.cheese
|
496
|
-
* // => false
|
497
|
-
*
|
498
|
-
* // required argument
|
499
|
-
* program.option('-C, --chdir <path>', 'change the working directory');
|
500
|
-
*
|
501
|
-
* --chdir /tmp
|
502
|
-
* program.chdir
|
503
|
-
* // => "/tmp"
|
504
|
-
*
|
505
|
-
* // optional argument
|
506
|
-
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
507
|
-
*
|
508
|
-
* @param {String} flags
|
509
|
-
* @param {String} description
|
510
|
-
* @param {Function|*} [fn] - custom option processing function or default vaue
|
511
|
-
* @param {*} [defaultValue]
|
512
|
-
* @return {Command} for chaining
|
513
|
-
* @api public
|
514
|
-
*/
|
515
|
-
|
516
|
-
Command.prototype.option = function(flags, description, fn, defaultValue) {
|
517
|
-
return this._optionEx({}, flags, description, fn, defaultValue);
|
518
|
-
};
|
519
|
-
|
520
|
-
/*
|
521
|
-
* Add a required option which must have a value after parsing. This usually means
|
522
|
-
* the option must be specified on the command line. (Otherwise the same as .option().)
|
523
|
-
*
|
524
|
-
* The `flags` string should contain both the short and long flags, separated by comma, a pipe or space.
|
525
|
-
*
|
526
|
-
* @param {String} flags
|
527
|
-
* @param {String} description
|
528
|
-
* @param {Function|*} [fn] - custom option processing function or default vaue
|
529
|
-
* @param {*} [defaultValue]
|
530
|
-
* @return {Command} for chaining
|
531
|
-
* @api public
|
532
|
-
*/
|
533
|
-
|
534
|
-
Command.prototype.requiredOption = function(flags, description, fn, defaultValue) {
|
535
|
-
return this._optionEx({ mandatory: true }, flags, description, fn, defaultValue);
|
536
|
-
};
|
537
|
-
|
538
|
-
/**
|
539
|
-
* Allow unknown options on the command line.
|
540
|
-
*
|
541
|
-
* @param {Boolean} arg if `true` or omitted, no error will be thrown
|
542
|
-
* for unknown options.
|
543
|
-
* @api public
|
544
|
-
*/
|
545
|
-
Command.prototype.allowUnknownOption = function(arg) {
|
546
|
-
this._allowUnknownOption = arguments.length === 0 || arg;
|
547
|
-
return this;
|
548
|
-
};
|
549
|
-
|
550
|
-
/**
|
551
|
-
* Whether to store option values as properties on command object,
|
552
|
-
* or store separately (specify false). In both cases the option values can be accessed using .opts().
|
553
|
-
*
|
554
|
-
* @param {boolean} value
|
555
|
-
* @return {Command} Command for chaining
|
556
|
-
* @api public
|
557
|
-
*/
|
558
|
-
|
559
|
-
Command.prototype.storeOptionsAsProperties = function(value) {
|
560
|
-
this._storeOptionsAsProperties = (value === undefined) || value;
|
561
|
-
if (this.options.length) {
|
562
|
-
// This is for programmer, not end user.
|
563
|
-
console.error('Commander usage error: call storeOptionsAsProperties before adding options');
|
564
|
-
}
|
565
|
-
return this;
|
566
|
-
};
|
567
|
-
|
568
|
-
/**
|
569
|
-
* Whether to pass command to action handler,
|
570
|
-
* or just the options (specify false).
|
571
|
-
*
|
572
|
-
* @param {boolean} value
|
573
|
-
* @return {Command} Command for chaining
|
574
|
-
* @api public
|
575
|
-
*/
|
576
|
-
|
577
|
-
Command.prototype.passCommandToAction = function(value) {
|
578
|
-
this._passCommandToAction = (value === undefined) || value;
|
579
|
-
return this;
|
580
|
-
};
|
581
|
-
|
582
|
-
/**
|
583
|
-
* Store option value
|
584
|
-
*
|
585
|
-
* @param {String} key
|
586
|
-
* @param {Object} value
|
587
|
-
* @api private
|
588
|
-
*/
|
589
|
-
|
590
|
-
Command.prototype._setOptionValue = function(key, value) {
|
591
|
-
if (this._storeOptionsAsProperties) {
|
592
|
-
this[key] = value;
|
593
|
-
} else {
|
594
|
-
this._optionValues[key] = value;
|
595
|
-
}
|
596
|
-
};
|
597
|
-
|
598
|
-
/**
|
599
|
-
* Retrieve option value
|
600
|
-
*
|
601
|
-
* @param {String} key
|
602
|
-
* @return {Object} value
|
603
|
-
* @api private
|
604
|
-
*/
|
605
|
-
|
606
|
-
Command.prototype._getOptionValue = function(key) {
|
607
|
-
if (this._storeOptionsAsProperties) {
|
608
|
-
return this[key];
|
609
|
-
}
|
610
|
-
return this._optionValues[key];
|
611
|
-
};
|
612
|
-
|
613
|
-
/**
|
614
|
-
* Parse `argv`, setting options and invoking commands when defined.
|
615
|
-
*
|
616
|
-
* @param {Array} argv
|
617
|
-
* @return {Command} for chaining
|
618
|
-
* @api public
|
619
|
-
*/
|
620
|
-
|
621
|
-
Command.prototype.parse = function(argv) {
|
622
|
-
// implicit help
|
623
|
-
if (this.executables) this.addImplicitHelpCommand();
|
624
|
-
|
625
|
-
// store raw args
|
626
|
-
this.rawArgs = argv;
|
627
|
-
|
628
|
-
// guess name
|
629
|
-
this._name = this._name || basename(argv[1], '.js');
|
630
|
-
|
631
|
-
// github-style sub-commands with no sub-command
|
632
|
-
if (this.executables && argv.length < 3 && !this.defaultExecutable) {
|
633
|
-
// this user needs help
|
634
|
-
argv.push(this._helpLongFlag);
|
635
|
-
}
|
636
|
-
|
637
|
-
// process argv
|
638
|
-
var normalized = this.normalize(argv.slice(2));
|
639
|
-
var parsed = this.parseOptions(normalized);
|
640
|
-
var args = this.args = parsed.args;
|
641
|
-
|
642
|
-
var result = this.parseArgs(this.args, parsed.unknown);
|
643
|
-
|
644
|
-
if (args[0] === 'help' && args.length === 1) this.help();
|
645
|
-
|
646
|
-
// Note for future: we could return early if we found an action handler in parseArgs, as none of following code needed?
|
647
|
-
|
648
|
-
// <cmd> --help
|
649
|
-
if (args[0] === 'help') {
|
650
|
-
args[0] = args[1];
|
651
|
-
args[1] = this._helpLongFlag;
|
652
|
-
} else {
|
653
|
-
// If calling through to executable subcommand we could check for help flags before failing,
|
654
|
-
// but a somewhat unlikely case since program options not passed to executable subcommands.
|
655
|
-
// Wait for reports to see if check needed and what usage pattern is.
|
656
|
-
this._checkForMissingMandatoryOptions();
|
657
|
-
}
|
658
|
-
|
659
|
-
// executable sub-commands
|
660
|
-
// (Debugging note for future: args[0] is not right if an action has been called)
|
661
|
-
var name = result.args[0];
|
662
|
-
var subCommand = null;
|
663
|
-
|
664
|
-
// Look for subcommand
|
665
|
-
if (name) {
|
666
|
-
subCommand = this.commands.find(function(command) {
|
667
|
-
return command._name === name;
|
668
|
-
});
|
669
|
-
}
|
670
|
-
|
671
|
-
// Look for alias
|
672
|
-
if (!subCommand && name) {
|
673
|
-
subCommand = this.commands.find(function(command) {
|
674
|
-
return command.alias() === name;
|
675
|
-
});
|
676
|
-
if (subCommand) {
|
677
|
-
name = subCommand._name;
|
678
|
-
args[0] = name;
|
679
|
-
}
|
680
|
-
}
|
681
|
-
|
682
|
-
// Look for default subcommand
|
683
|
-
if (!subCommand && this.defaultExecutable) {
|
684
|
-
name = this.defaultExecutable;
|
685
|
-
args.unshift(name);
|
686
|
-
subCommand = this.commands.find(function(command) {
|
687
|
-
return command._name === name;
|
688
|
-
});
|
689
|
-
}
|
690
|
-
|
691
|
-
if (this._execs.has(name)) {
|
692
|
-
return this.executeSubCommand(argv, args, parsed.unknown, subCommand ? subCommand._executableFile : undefined);
|
693
|
-
}
|
694
|
-
|
695
|
-
return result;
|
696
|
-
};
|
697
|
-
|
698
|
-
/**
|
699
|
-
* Parse `argv`, setting options and invoking commands when defined.
|
700
|
-
*
|
701
|
-
* Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise.
|
702
|
-
*
|
703
|
-
* @param {Array} argv
|
704
|
-
* @return {Promise}
|
705
|
-
* @api public
|
706
|
-
*/
|
707
|
-
Command.prototype.parseAsync = function(argv) {
|
708
|
-
this.parse(argv);
|
709
|
-
return Promise.all(this._actionResults);
|
710
|
-
};
|
711
|
-
|
712
|
-
/**
|
713
|
-
* Execute a sub-command executable.
|
714
|
-
*
|
715
|
-
* @param {Array} argv
|
716
|
-
* @param {Array} args
|
717
|
-
* @param {Array} unknown
|
718
|
-
* @param {String} executableFile
|
719
|
-
* @api private
|
720
|
-
*/
|
721
|
-
|
722
|
-
Command.prototype.executeSubCommand = function(argv, args, unknown, executableFile) {
|
723
|
-
args = args.concat(unknown);
|
724
|
-
|
725
|
-
if (!args.length) this.help();
|
726
|
-
|
727
|
-
var isExplicitJS = false; // Whether to use node to launch "executable"
|
728
|
-
|
729
|
-
// executable
|
730
|
-
var pm = argv[1];
|
731
|
-
// name of the subcommand, like `pm-install`
|
732
|
-
var bin = basename(pm, path.extname(pm)) + '-' + args[0];
|
733
|
-
if (executableFile != null) {
|
734
|
-
bin = executableFile;
|
735
|
-
// Check for same extensions as we scan for below so get consistent launch behaviour.
|
736
|
-
var executableExt = path.extname(executableFile);
|
737
|
-
isExplicitJS = executableExt === '.js' || executableExt === '.ts' || executableExt === '.mjs';
|
738
|
-
}
|
739
|
-
|
740
|
-
// In case of globally installed, get the base dir where executable
|
741
|
-
// subcommand file should be located at
|
742
|
-
var baseDir;
|
743
|
-
|
744
|
-
var resolvedLink = fs.realpathSync(pm);
|
745
|
-
|
746
|
-
baseDir = dirname(resolvedLink);
|
747
|
-
|
748
|
-
// prefer local `./<bin>` to bin in the $PATH
|
749
|
-
var localBin = path.join(baseDir, bin);
|
750
|
-
|
751
|
-
// whether bin file is a js script with explicit `.js` or `.ts` extension
|
752
|
-
if (exists(localBin + '.js')) {
|
753
|
-
bin = localBin + '.js';
|
754
|
-
isExplicitJS = true;
|
755
|
-
} else if (exists(localBin + '.ts')) {
|
756
|
-
bin = localBin + '.ts';
|
757
|
-
isExplicitJS = true;
|
758
|
-
} else if (exists(localBin + '.mjs')) {
|
759
|
-
bin = localBin + '.mjs';
|
760
|
-
isExplicitJS = true;
|
761
|
-
} else if (exists(localBin)) {
|
762
|
-
bin = localBin;
|
763
|
-
}
|
764
|
-
|
765
|
-
args = args.slice(1);
|
766
|
-
|
767
|
-
var proc;
|
768
|
-
if (process.platform !== 'win32') {
|
769
|
-
if (isExplicitJS) {
|
770
|
-
args.unshift(bin);
|
771
|
-
// add executable arguments to spawn
|
772
|
-
args = incrementNodeInspectorPort(process.execArgv).concat(args);
|
773
|
-
|
774
|
-
proc = spawn(process.argv[0], args, { stdio: 'inherit' });
|
775
|
-
} else {
|
776
|
-
proc = spawn(bin, args, { stdio: 'inherit' });
|
777
|
-
}
|
778
|
-
} else {
|
779
|
-
args.unshift(bin);
|
780
|
-
// add executable arguments to spawn
|
781
|
-
args = incrementNodeInspectorPort(process.execArgv).concat(args);
|
782
|
-
proc = spawn(process.execPath, args, { stdio: 'inherit' });
|
783
|
-
}
|
784
|
-
|
785
|
-
var signals = ['SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGINT', 'SIGHUP'];
|
786
|
-
signals.forEach(function(signal) {
|
787
|
-
process.on(signal, function() {
|
788
|
-
if (proc.killed === false && proc.exitCode === null) {
|
789
|
-
proc.kill(signal);
|
790
|
-
}
|
791
|
-
});
|
792
|
-
});
|
793
|
-
|
794
|
-
// By default terminate process when spawned process terminates.
|
795
|
-
// Suppressing the exit if exitCallback defined is a bit messy and of limited use, but does allow process to stay running!
|
796
|
-
const exitCallback = this._exitCallback;
|
797
|
-
if (!exitCallback) {
|
798
|
-
proc.on('close', process.exit.bind(process));
|
799
|
-
} else {
|
800
|
-
proc.on('close', () => {
|
801
|
-
exitCallback(new CommanderError(process.exitCode || 0, 'commander.executeSubCommandAsync', '(close)'));
|
802
|
-
});
|
803
|
-
}
|
804
|
-
proc.on('error', function(err) {
|
805
|
-
if (err.code === 'ENOENT') {
|
806
|
-
console.error('error: %s(1) does not exist, try --help', bin);
|
807
|
-
} else if (err.code === 'EACCES') {
|
808
|
-
console.error('error: %s(1) not executable. try chmod or run with root', bin);
|
809
|
-
}
|
810
|
-
if (!exitCallback) {
|
811
|
-
process.exit(1);
|
812
|
-
} else {
|
813
|
-
const wrappedError = new CommanderError(1, 'commander.executeSubCommandAsync', '(error)');
|
814
|
-
wrappedError.nestedError = err;
|
815
|
-
exitCallback(wrappedError);
|
816
|
-
}
|
817
|
-
});
|
818
|
-
|
819
|
-
// Store the reference to the child process
|
820
|
-
this.runningCommand = proc;
|
821
|
-
};
|
822
|
-
|
823
|
-
/**
|
824
|
-
* Normalize `args`, splitting joined short flags. For example
|
825
|
-
* the arg "-abc" is equivalent to "-a -b -c".
|
826
|
-
* This also normalizes equal sign and splits "--abc=def" into "--abc def".
|
827
|
-
*
|
828
|
-
* @param {Array} args
|
829
|
-
* @return {Array}
|
830
|
-
* @api private
|
831
|
-
*/
|
832
|
-
|
833
|
-
Command.prototype.normalize = function(args) {
|
834
|
-
var ret = [],
|
835
|
-
arg,
|
836
|
-
lastOpt,
|
837
|
-
index,
|
838
|
-
short,
|
839
|
-
opt;
|
840
|
-
|
841
|
-
for (var i = 0, len = args.length; i < len; ++i) {
|
842
|
-
arg = args[i];
|
843
|
-
if (i > 0) {
|
844
|
-
lastOpt = this.optionFor(args[i - 1]);
|
845
|
-
}
|
846
|
-
|
847
|
-
if (arg === '--') {
|
848
|
-
// Honor option terminator
|
849
|
-
ret = ret.concat(args.slice(i));
|
850
|
-
break;
|
851
|
-
} else if (lastOpt && lastOpt.required) {
|
852
|
-
ret.push(arg);
|
853
|
-
} else if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') {
|
854
|
-
short = arg.slice(0, 2);
|
855
|
-
opt = this.optionFor(short);
|
856
|
-
if (opt && (opt.required || opt.optional)) {
|
857
|
-
ret.push(short);
|
858
|
-
ret.push(arg.slice(2));
|
859
|
-
} else {
|
860
|
-
arg.slice(1).split('').forEach(function(c) {
|
861
|
-
ret.push('-' + c);
|
862
|
-
});
|
863
|
-
}
|
864
|
-
} else if (/^--/.test(arg) && ~(index = arg.indexOf('='))) {
|
865
|
-
ret.push(arg.slice(0, index), arg.slice(index + 1));
|
866
|
-
} else {
|
867
|
-
ret.push(arg);
|
868
|
-
}
|
869
|
-
}
|
870
|
-
|
871
|
-
return ret;
|
872
|
-
};
|
873
|
-
|
874
|
-
/**
|
875
|
-
* Parse command `args`.
|
876
|
-
*
|
877
|
-
* When listener(s) are available those
|
878
|
-
* callbacks are invoked, otherwise the "*"
|
879
|
-
* event is emitted and those actions are invoked.
|
880
|
-
*
|
881
|
-
* @param {Array} args
|
882
|
-
* @return {Command} for chaining
|
883
|
-
* @api private
|
884
|
-
*/
|
885
|
-
|
886
|
-
Command.prototype.parseArgs = function(args, unknown) {
|
887
|
-
var name;
|
888
|
-
|
889
|
-
if (args.length) {
|
890
|
-
name = args[0];
|
891
|
-
if (this.listeners('command:' + name).length) {
|
892
|
-
this.emit('command:' + args.shift(), args, unknown);
|
893
|
-
} else {
|
894
|
-
this.emit('command:*', args, unknown);
|
895
|
-
}
|
896
|
-
} else {
|
897
|
-
outputHelpIfRequested(this, unknown);
|
898
|
-
|
899
|
-
// If there were no args and we have unknown options,
|
900
|
-
// then they are extraneous and we need to error.
|
901
|
-
if (unknown.length > 0 && !this.defaultExecutable) {
|
902
|
-
this.unknownOption(unknown[0]);
|
903
|
-
}
|
904
|
-
if (this.commands.length === 0 &&
|
905
|
-
this._args.filter(function(a) { return a.required; }).length === 0) {
|
906
|
-
this.emit('command:*');
|
907
|
-
}
|
908
|
-
}
|
909
|
-
|
910
|
-
return this;
|
911
|
-
};
|
912
|
-
|
913
|
-
/**
|
914
|
-
* Return an option matching `arg` if any.
|
915
|
-
*
|
916
|
-
* @param {String} arg
|
917
|
-
* @return {Option}
|
918
|
-
* @api private
|
919
|
-
*/
|
920
|
-
|
921
|
-
Command.prototype.optionFor = function(arg) {
|
922
|
-
for (var i = 0, len = this.options.length; i < len; ++i) {
|
923
|
-
if (this.options[i].is(arg)) {
|
924
|
-
return this.options[i];
|
925
|
-
}
|
926
|
-
}
|
927
|
-
};
|
928
|
-
|
929
|
-
/**
|
930
|
-
* Display an error message if a mandatory option does not have a value.
|
931
|
-
*
|
932
|
-
* @api private
|
933
|
-
*/
|
934
|
-
|
935
|
-
Command.prototype._checkForMissingMandatoryOptions = function() {
|
936
|
-
// Walk up hierarchy so can call from action handler after checking for displaying help.
|
937
|
-
for (var cmd = this; cmd; cmd = cmd.parent) {
|
938
|
-
cmd.options.forEach((anOption) => {
|
939
|
-
if (anOption.mandatory && (cmd._getOptionValue(anOption.attributeName()) === undefined)) {
|
940
|
-
cmd.missingMandatoryOptionValue(anOption);
|
941
|
-
}
|
942
|
-
});
|
943
|
-
}
|
944
|
-
};
|
945
|
-
|
946
|
-
/**
|
947
|
-
* Parse options from `argv` returning `argv`
|
948
|
-
* void of these options.
|
949
|
-
*
|
950
|
-
* @param {Array} argv
|
951
|
-
* @return {{args: Array, unknown: Array}}
|
952
|
-
* @api public
|
953
|
-
*/
|
954
|
-
|
955
|
-
Command.prototype.parseOptions = function(argv) {
|
956
|
-
var args = [],
|
957
|
-
len = argv.length,
|
958
|
-
literal,
|
959
|
-
option,
|
960
|
-
arg;
|
961
|
-
|
962
|
-
var unknownOptions = [];
|
963
|
-
|
964
|
-
// parse options
|
965
|
-
for (var i = 0; i < len; ++i) {
|
966
|
-
arg = argv[i];
|
967
|
-
|
968
|
-
// literal args after --
|
969
|
-
if (literal) {
|
970
|
-
args.push(arg);
|
971
|
-
continue;
|
972
|
-
}
|
973
|
-
|
974
|
-
if (arg === '--') {
|
975
|
-
literal = true;
|
976
|
-
continue;
|
977
|
-
}
|
978
|
-
|
979
|
-
// find matching Option
|
980
|
-
option = this.optionFor(arg);
|
981
|
-
|
982
|
-
// option is defined
|
983
|
-
if (option) {
|
984
|
-
// requires arg
|
985
|
-
if (option.required) {
|
986
|
-
arg = argv[++i];
|
987
|
-
if (arg == null) return this.optionMissingArgument(option);
|
988
|
-
this.emit('option:' + option.name(), arg);
|
989
|
-
// optional arg
|
990
|
-
} else if (option.optional) {
|
991
|
-
arg = argv[i + 1];
|
992
|
-
if (arg == null || (arg[0] === '-' && arg !== '-')) {
|
993
|
-
arg = null;
|
994
|
-
} else {
|
995
|
-
++i;
|
996
|
-
}
|
997
|
-
this.emit('option:' + option.name(), arg);
|
998
|
-
// flag
|
999
|
-
} else {
|
1000
|
-
this.emit('option:' + option.name());
|
1001
|
-
}
|
1002
|
-
continue;
|
1003
|
-
}
|
1004
|
-
|
1005
|
-
// looks like an option
|
1006
|
-
if (arg.length > 1 && arg[0] === '-') {
|
1007
|
-
unknownOptions.push(arg);
|
1008
|
-
|
1009
|
-
// If the next argument looks like it might be
|
1010
|
-
// an argument for this option, we pass it on.
|
1011
|
-
// If it isn't, then it'll simply be ignored
|
1012
|
-
if ((i + 1) < argv.length && (argv[i + 1][0] !== '-' || argv[i + 1] === '-')) {
|
1013
|
-
unknownOptions.push(argv[++i]);
|
1014
|
-
}
|
1015
|
-
continue;
|
1016
|
-
}
|
1017
|
-
|
1018
|
-
// arg
|
1019
|
-
args.push(arg);
|
1020
|
-
}
|
1021
|
-
|
1022
|
-
return { args: args, unknown: unknownOptions };
|
1023
|
-
};
|
1024
|
-
|
1025
|
-
/**
|
1026
|
-
* Return an object containing options as key-value pairs
|
1027
|
-
*
|
1028
|
-
* @return {Object}
|
1029
|
-
* @api public
|
1030
|
-
*/
|
1031
|
-
Command.prototype.opts = function() {
|
1032
|
-
if (this._storeOptionsAsProperties) {
|
1033
|
-
// Preserve original behaviour so backwards compatible when still using properties
|
1034
|
-
var result = {},
|
1035
|
-
len = this.options.length;
|
1036
|
-
|
1037
|
-
for (var i = 0; i < len; i++) {
|
1038
|
-
var key = this.options[i].attributeName();
|
1039
|
-
result[key] = key === this._versionOptionName ? this._version : this[key];
|
1040
|
-
}
|
1041
|
-
return result;
|
1042
|
-
}
|
1043
|
-
|
1044
|
-
return this._optionValues;
|
1045
|
-
};
|
1046
|
-
|
1047
|
-
/**
|
1048
|
-
* Argument `name` is missing.
|
1049
|
-
*
|
1050
|
-
* @param {String} name
|
1051
|
-
* @api private
|
1052
|
-
*/
|
1053
|
-
|
1054
|
-
Command.prototype.missingArgument = function(name) {
|
1055
|
-
const message = `error: missing required argument '${name}'`;
|
1056
|
-
console.error(message);
|
1057
|
-
this._exit(1, 'commander.missingArgument', message);
|
1058
|
-
};
|
1059
|
-
|
1060
|
-
/**
|
1061
|
-
* `Option` is missing an argument, but received `flag` or nothing.
|
1062
|
-
*
|
1063
|
-
* @param {Option} option
|
1064
|
-
* @param {String} [flag]
|
1065
|
-
* @api private
|
1066
|
-
*/
|
1067
|
-
|
1068
|
-
Command.prototype.optionMissingArgument = function(option, flag) {
|
1069
|
-
let message;
|
1070
|
-
if (flag) {
|
1071
|
-
message = `error: option '${option.flags}' argument missing, got '${flag}'`;
|
1072
|
-
} else {
|
1073
|
-
message = `error: option '${option.flags}' argument missing`;
|
1074
|
-
}
|
1075
|
-
console.error(message);
|
1076
|
-
this._exit(1, 'commander.optionMissingArgument', message);
|
1077
|
-
};
|
1078
|
-
|
1079
|
-
/**
|
1080
|
-
* `Option` does not have a value, and is a mandatory option.
|
1081
|
-
*
|
1082
|
-
* @param {Option} option
|
1083
|
-
* @api private
|
1084
|
-
*/
|
1085
|
-
|
1086
|
-
Command.prototype.missingMandatoryOptionValue = function(option) {
|
1087
|
-
const message = `error: required option '${option.flags}' not specified`;
|
1088
|
-
console.error(message);
|
1089
|
-
this._exit(1, 'commander.missingMandatoryOptionValue', message);
|
1090
|
-
};
|
1091
|
-
|
1092
|
-
/**
|
1093
|
-
* Unknown option `flag`.
|
1094
|
-
*
|
1095
|
-
* @param {String} flag
|
1096
|
-
* @api private
|
1097
|
-
*/
|
1098
|
-
|
1099
|
-
Command.prototype.unknownOption = function(flag) {
|
1100
|
-
if (this._allowUnknownOption) return;
|
1101
|
-
const message = `error: unknown option '${flag}'`;
|
1102
|
-
console.error(message);
|
1103
|
-
this._exit(1, 'commander.unknownOption', message);
|
1104
|
-
};
|
1105
|
-
|
1106
|
-
/**
|
1107
|
-
* Variadic argument with `name` is not the last argument as required.
|
1108
|
-
*
|
1109
|
-
* @param {String} name
|
1110
|
-
* @api private
|
1111
|
-
*/
|
1112
|
-
|
1113
|
-
Command.prototype.variadicArgNotLast = function(name) {
|
1114
|
-
const message = `error: variadic arguments must be last '${name}'`;
|
1115
|
-
console.error(message);
|
1116
|
-
this._exit(1, 'commander.variadicArgNotLast', message);
|
1117
|
-
};
|
1118
|
-
|
1119
|
-
/**
|
1120
|
-
* Set the program version to `str`.
|
1121
|
-
*
|
1122
|
-
* This method auto-registers the "-V, --version" flag
|
1123
|
-
* which will print the version number when passed.
|
1124
|
-
*
|
1125
|
-
* You can optionally supply the flags and description to override the defaults.
|
1126
|
-
*
|
1127
|
-
* @param {String} str
|
1128
|
-
* @param {String} [flags]
|
1129
|
-
* @param {String} [description]
|
1130
|
-
* @return {Command} for chaining
|
1131
|
-
* @api public
|
1132
|
-
*/
|
1133
|
-
|
1134
|
-
Command.prototype.version = function(str, flags, description) {
|
1135
|
-
if (arguments.length === 0) return this._version;
|
1136
|
-
this._version = str;
|
1137
|
-
flags = flags || '-V, --version';
|
1138
|
-
description = description || 'output the version number';
|
1139
|
-
var versionOption = new Option(flags, description);
|
1140
|
-
this._versionOptionName = versionOption.long.substr(2) || 'version';
|
1141
|
-
this.options.push(versionOption);
|
1142
|
-
var self = this;
|
1143
|
-
this.on('option:' + this._versionOptionName, function() {
|
1144
|
-
process.stdout.write(str + '\n');
|
1145
|
-
self._exit(0, 'commander.version', str);
|
1146
|
-
});
|
1147
|
-
return this;
|
1148
|
-
};
|
1149
|
-
|
1150
|
-
/**
|
1151
|
-
* Set the description to `str`.
|
1152
|
-
*
|
1153
|
-
* @param {String} str
|
1154
|
-
* @param {Object} [argsDescription]
|
1155
|
-
* @return {String|Command}
|
1156
|
-
* @api public
|
1157
|
-
*/
|
1158
|
-
|
1159
|
-
Command.prototype.description = function(str, argsDescription) {
|
1160
|
-
if (arguments.length === 0) return this._description;
|
1161
|
-
this._description = str;
|
1162
|
-
this._argsDescription = argsDescription;
|
1163
|
-
return this;
|
1164
|
-
};
|
1165
|
-
|
1166
|
-
/**
|
1167
|
-
* Set an alias for the command
|
1168
|
-
*
|
1169
|
-
* @param {String} alias
|
1170
|
-
* @return {String|Command}
|
1171
|
-
* @api public
|
1172
|
-
*/
|
1173
|
-
|
1174
|
-
Command.prototype.alias = function(alias) {
|
1175
|
-
var command = this;
|
1176
|
-
if (this.commands.length !== 0) {
|
1177
|
-
command = this.commands[this.commands.length - 1];
|
1178
|
-
}
|
1179
|
-
|
1180
|
-
if (arguments.length === 0) return command._alias;
|
1181
|
-
|
1182
|
-
if (alias === command._name) throw new Error('Command alias can\'t be the same as its name');
|
1183
|
-
|
1184
|
-
command._alias = alias;
|
1185
|
-
return this;
|
1186
|
-
};
|
1187
|
-
|
1188
|
-
/**
|
1189
|
-
* Set / get the command usage `str`.
|
1190
|
-
*
|
1191
|
-
* @param {String} [str]
|
1192
|
-
* @return {String|Command}
|
1193
|
-
* @api public
|
1194
|
-
*/
|
1195
|
-
|
1196
|
-
Command.prototype.usage = function(str) {
|
1197
|
-
var args = this._args.map(function(arg) {
|
1198
|
-
return humanReadableArgName(arg);
|
1199
|
-
});
|
1200
|
-
|
1201
|
-
var usage = '[options]' +
|
1202
|
-
(this.commands.length ? ' [command]' : '') +
|
1203
|
-
(this._args.length ? ' ' + args.join(' ') : '');
|
1204
|
-
|
1205
|
-
if (arguments.length === 0) return this._usage || usage;
|
1206
|
-
this._usage = str;
|
1207
|
-
|
1208
|
-
return this;
|
1209
|
-
};
|
1210
|
-
|
1211
|
-
/**
|
1212
|
-
* Get or set the name of the command
|
1213
|
-
*
|
1214
|
-
* @param {String} [str]
|
1215
|
-
* @return {String|Command}
|
1216
|
-
* @api public
|
1217
|
-
*/
|
1218
|
-
|
1219
|
-
Command.prototype.name = function(str) {
|
1220
|
-
if (arguments.length === 0) return this._name;
|
1221
|
-
this._name = str;
|
1222
|
-
return this;
|
1223
|
-
};
|
1224
|
-
|
1225
|
-
/**
|
1226
|
-
* Return prepared commands.
|
1227
|
-
*
|
1228
|
-
* @return {Array}
|
1229
|
-
* @api private
|
1230
|
-
*/
|
1231
|
-
|
1232
|
-
Command.prototype.prepareCommands = function() {
|
1233
|
-
return this.commands.filter(function(cmd) {
|
1234
|
-
return !cmd._noHelp;
|
1235
|
-
}).map(function(cmd) {
|
1236
|
-
var args = cmd._args.map(function(arg) {
|
1237
|
-
return humanReadableArgName(arg);
|
1238
|
-
}).join(' ');
|
1239
|
-
|
1240
|
-
return [
|
1241
|
-
cmd._name +
|
1242
|
-
(cmd._alias ? '|' + cmd._alias : '') +
|
1243
|
-
(cmd.options.length ? ' [options]' : '') +
|
1244
|
-
(args ? ' ' + args : ''),
|
1245
|
-
cmd._description
|
1246
|
-
];
|
1247
|
-
});
|
1248
|
-
};
|
1249
|
-
|
1250
|
-
/**
|
1251
|
-
* Return the largest command length.
|
1252
|
-
*
|
1253
|
-
* @return {Number}
|
1254
|
-
* @api private
|
1255
|
-
*/
|
1256
|
-
|
1257
|
-
Command.prototype.largestCommandLength = function() {
|
1258
|
-
var commands = this.prepareCommands();
|
1259
|
-
return commands.reduce(function(max, command) {
|
1260
|
-
return Math.max(max, command[0].length);
|
1261
|
-
}, 0);
|
1262
|
-
};
|
1263
|
-
|
1264
|
-
/**
|
1265
|
-
* Return the largest option length.
|
1266
|
-
*
|
1267
|
-
* @return {Number}
|
1268
|
-
* @api private
|
1269
|
-
*/
|
1270
|
-
|
1271
|
-
Command.prototype.largestOptionLength = function() {
|
1272
|
-
var options = [].slice.call(this.options);
|
1273
|
-
options.push({
|
1274
|
-
flags: this._helpFlags
|
1275
|
-
});
|
1276
|
-
|
1277
|
-
return options.reduce(function(max, option) {
|
1278
|
-
return Math.max(max, option.flags.length);
|
1279
|
-
}, 0);
|
1280
|
-
};
|
1281
|
-
|
1282
|
-
/**
|
1283
|
-
* Return the largest arg length.
|
1284
|
-
*
|
1285
|
-
* @return {Number}
|
1286
|
-
* @api private
|
1287
|
-
*/
|
1288
|
-
|
1289
|
-
Command.prototype.largestArgLength = function() {
|
1290
|
-
return this._args.reduce(function(max, arg) {
|
1291
|
-
return Math.max(max, arg.name.length);
|
1292
|
-
}, 0);
|
1293
|
-
};
|
1294
|
-
|
1295
|
-
/**
|
1296
|
-
* Return the pad width.
|
1297
|
-
*
|
1298
|
-
* @return {Number}
|
1299
|
-
* @api private
|
1300
|
-
*/
|
1301
|
-
|
1302
|
-
Command.prototype.padWidth = function() {
|
1303
|
-
var width = this.largestOptionLength();
|
1304
|
-
if (this._argsDescription && this._args.length) {
|
1305
|
-
if (this.largestArgLength() > width) {
|
1306
|
-
width = this.largestArgLength();
|
1307
|
-
}
|
1308
|
-
}
|
1309
|
-
|
1310
|
-
if (this.commands && this.commands.length) {
|
1311
|
-
if (this.largestCommandLength() > width) {
|
1312
|
-
width = this.largestCommandLength();
|
1313
|
-
}
|
1314
|
-
}
|
1315
|
-
|
1316
|
-
return width;
|
1317
|
-
};
|
1318
|
-
|
1319
|
-
/**
|
1320
|
-
* Return help for options.
|
1321
|
-
*
|
1322
|
-
* @return {String}
|
1323
|
-
* @api private
|
1324
|
-
*/
|
1325
|
-
|
1326
|
-
Command.prototype.optionHelp = function() {
|
1327
|
-
var width = this.padWidth();
|
1328
|
-
|
1329
|
-
var columns = process.stdout.columns || 80;
|
1330
|
-
var descriptionWidth = columns - width - 4;
|
1331
|
-
|
1332
|
-
// Append the help information
|
1333
|
-
return this.options.map(function(option) {
|
1334
|
-
const fullDesc = option.description +
|
1335
|
-
((!option.negate && option.defaultValue !== undefined) ? ' (default: ' + JSON.stringify(option.defaultValue) + ')' : '');
|
1336
|
-
return pad(option.flags, width) + ' ' + optionalWrap(fullDesc, descriptionWidth, width + 2);
|
1337
|
-
}).concat([pad(this._helpFlags, width) + ' ' + optionalWrap(this._helpDescription, descriptionWidth, width + 2)])
|
1338
|
-
.join('\n');
|
1339
|
-
};
|
1340
|
-
|
1341
|
-
/**
|
1342
|
-
* Return command help documentation.
|
1343
|
-
*
|
1344
|
-
* @return {String}
|
1345
|
-
* @api private
|
1346
|
-
*/
|
1347
|
-
|
1348
|
-
Command.prototype.commandHelp = function() {
|
1349
|
-
if (!this.commands.length) return '';
|
1350
|
-
|
1351
|
-
var commands = this.prepareCommands();
|
1352
|
-
var width = this.padWidth();
|
1353
|
-
|
1354
|
-
var columns = process.stdout.columns || 80;
|
1355
|
-
var descriptionWidth = columns - width - 4;
|
1356
|
-
|
1357
|
-
return [
|
1358
|
-
'Commands:',
|
1359
|
-
commands.map(function(cmd) {
|
1360
|
-
var desc = cmd[1] ? ' ' + cmd[1] : '';
|
1361
|
-
return (desc ? pad(cmd[0], width) : cmd[0]) + optionalWrap(desc, descriptionWidth, width + 2);
|
1362
|
-
}).join('\n').replace(/^/gm, ' '),
|
1363
|
-
''
|
1364
|
-
].join('\n');
|
1365
|
-
};
|
1366
|
-
|
1367
|
-
/**
|
1368
|
-
* Return program help documentation.
|
1369
|
-
*
|
1370
|
-
* @return {String}
|
1371
|
-
* @api private
|
1372
|
-
*/
|
1373
|
-
|
1374
|
-
Command.prototype.helpInformation = function() {
|
1375
|
-
var desc = [];
|
1376
|
-
if (this._description) {
|
1377
|
-
desc = [
|
1378
|
-
this._description,
|
1379
|
-
''
|
1380
|
-
];
|
1381
|
-
|
1382
|
-
var argsDescription = this._argsDescription;
|
1383
|
-
if (argsDescription && this._args.length) {
|
1384
|
-
var width = this.padWidth();
|
1385
|
-
var columns = process.stdout.columns || 80;
|
1386
|
-
var descriptionWidth = columns - width - 5;
|
1387
|
-
desc.push('Arguments:');
|
1388
|
-
desc.push('');
|
1389
|
-
this._args.forEach(function(arg) {
|
1390
|
-
desc.push(' ' + pad(arg.name, width) + ' ' + wrap(argsDescription[arg.name], descriptionWidth, width + 4));
|
1391
|
-
});
|
1392
|
-
desc.push('');
|
1393
|
-
}
|
1394
|
-
}
|
1395
|
-
|
1396
|
-
var cmdName = this._name;
|
1397
|
-
if (this._alias) {
|
1398
|
-
cmdName = cmdName + '|' + this._alias;
|
1399
|
-
}
|
1400
|
-
var parentCmdNames = '';
|
1401
|
-
for (var parentCmd = this.parent; parentCmd; parentCmd = parentCmd.parent) {
|
1402
|
-
parentCmdNames = parentCmd.name() + ' ' + parentCmdNames;
|
1403
|
-
}
|
1404
|
-
var usage = [
|
1405
|
-
'Usage: ' + parentCmdNames + cmdName + ' ' + this.usage(),
|
1406
|
-
''
|
1407
|
-
];
|
1408
|
-
|
1409
|
-
var cmds = [];
|
1410
|
-
var commandHelp = this.commandHelp();
|
1411
|
-
if (commandHelp) cmds = [commandHelp];
|
1412
|
-
|
1413
|
-
var options = [
|
1414
|
-
'Options:',
|
1415
|
-
'' + this.optionHelp().replace(/^/gm, ' '),
|
1416
|
-
''
|
1417
|
-
];
|
1418
|
-
|
1419
|
-
return usage
|
1420
|
-
.concat(desc)
|
1421
|
-
.concat(options)
|
1422
|
-
.concat(cmds)
|
1423
|
-
.join('\n');
|
1424
|
-
};
|
1425
|
-
|
1426
|
-
/**
|
1427
|
-
* Output help information for this command.
|
1428
|
-
*
|
1429
|
-
* When listener(s) are available for the helpLongFlag
|
1430
|
-
* those callbacks are invoked.
|
1431
|
-
*
|
1432
|
-
* @api public
|
1433
|
-
*/
|
1434
|
-
|
1435
|
-
Command.prototype.outputHelp = function(cb) {
|
1436
|
-
if (!cb) {
|
1437
|
-
cb = function(passthru) {
|
1438
|
-
return passthru;
|
1439
|
-
};
|
1440
|
-
}
|
1441
|
-
const cbOutput = cb(this.helpInformation());
|
1442
|
-
if (typeof cbOutput !== 'string' && !Buffer.isBuffer(cbOutput)) {
|
1443
|
-
throw new Error('outputHelp callback must return a string or a Buffer');
|
1444
|
-
}
|
1445
|
-
process.stdout.write(cbOutput);
|
1446
|
-
this.emit(this._helpLongFlag);
|
1447
|
-
};
|
1448
|
-
|
1449
|
-
/**
|
1450
|
-
* You can pass in flags and a description to override the help
|
1451
|
-
* flags and help description for your command.
|
1452
|
-
*
|
1453
|
-
* @param {String} [flags]
|
1454
|
-
* @param {String} [description]
|
1455
|
-
* @return {Command}
|
1456
|
-
* @api public
|
1457
|
-
*/
|
1458
|
-
|
1459
|
-
Command.prototype.helpOption = function(flags, description) {
|
1460
|
-
this._helpFlags = flags || this._helpFlags;
|
1461
|
-
this._helpDescription = description || this._helpDescription;
|
1462
|
-
|
1463
|
-
var splitFlags = this._helpFlags.split(/[ ,|]+/);
|
1464
|
-
|
1465
|
-
if (splitFlags.length > 1) this._helpShortFlag = splitFlags.shift();
|
1466
|
-
|
1467
|
-
this._helpLongFlag = splitFlags.shift();
|
1468
|
-
|
1469
|
-
return this;
|
1470
|
-
};
|
1471
|
-
|
1472
|
-
/**
|
1473
|
-
* Output help information and exit.
|
1474
|
-
*
|
1475
|
-
* @param {Function} [cb]
|
1476
|
-
* @api public
|
1477
|
-
*/
|
1478
|
-
|
1479
|
-
Command.prototype.help = function(cb) {
|
1480
|
-
this.outputHelp(cb);
|
1481
|
-
// exitCode: preserving original behaviour which was calling process.exit()
|
1482
|
-
// message: do not have all displayed text available so only passing placeholder.
|
1483
|
-
this._exit(process.exitCode || 0, 'commander.help', '(outputHelp)');
|
1484
|
-
};
|
1485
|
-
|
1486
|
-
/**
|
1487
|
-
* Camel-case the given `flag`
|
1488
|
-
*
|
1489
|
-
* @param {String} flag
|
1490
|
-
* @return {String}
|
1491
|
-
* @api private
|
1492
|
-
*/
|
1493
|
-
|
1494
|
-
function camelcase(flag) {
|
1495
|
-
return flag.split('-').reduce(function(str, word) {
|
1496
|
-
return str + word[0].toUpperCase() + word.slice(1);
|
1497
|
-
});
|
1498
|
-
}
|
1499
|
-
|
1500
|
-
/**
|
1501
|
-
* Pad `str` to `width`.
|
1502
|
-
*
|
1503
|
-
* @param {String} str
|
1504
|
-
* @param {Number} width
|
1505
|
-
* @return {String}
|
1506
|
-
* @api private
|
1507
|
-
*/
|
1508
|
-
|
1509
|
-
function pad(str, width) {
|
1510
|
-
var len = Math.max(0, width - str.length);
|
1511
|
-
return str + Array(len + 1).join(' ');
|
1512
|
-
}
|
1513
|
-
|
1514
|
-
/**
|
1515
|
-
* Wraps the given string with line breaks at the specified width while breaking
|
1516
|
-
* words and indenting every but the first line on the left.
|
1517
|
-
*
|
1518
|
-
* @param {String} str
|
1519
|
-
* @param {Number} width
|
1520
|
-
* @param {Number} indent
|
1521
|
-
* @return {String}
|
1522
|
-
* @api private
|
1523
|
-
*/
|
1524
|
-
function wrap(str, width, indent) {
|
1525
|
-
var regex = new RegExp('.{1,' + (width - 1) + '}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)', 'g');
|
1526
|
-
var lines = str.match(regex) || [];
|
1527
|
-
return lines.map(function(line, i) {
|
1528
|
-
if (line.slice(-1) === '\n') {
|
1529
|
-
line = line.slice(0, line.length - 1);
|
1530
|
-
}
|
1531
|
-
return ((i > 0 && indent) ? Array(indent + 1).join(' ') : '') + line.trimRight();
|
1532
|
-
}).join('\n');
|
1533
|
-
}
|
1534
|
-
|
1535
|
-
/**
|
1536
|
-
* Optionally wrap the given str to a max width of width characters per line
|
1537
|
-
* while indenting with indent spaces. Do not wrap if insufficient width or
|
1538
|
-
* string is manually formatted.
|
1539
|
-
*
|
1540
|
-
* @param {String} str
|
1541
|
-
* @param {Number} width
|
1542
|
-
* @param {Number} indent
|
1543
|
-
* @return {String}
|
1544
|
-
* @api private
|
1545
|
-
*/
|
1546
|
-
function optionalWrap(str, width, indent) {
|
1547
|
-
// Detect manually wrapped and indented strings by searching for line breaks
|
1548
|
-
// followed by multiple spaces/tabs.
|
1549
|
-
if (str.match(/[\n]\s+/)) return str;
|
1550
|
-
// Do not wrap to narrow columns (or can end up with a word per line).
|
1551
|
-
const minWidth = 40;
|
1552
|
-
if (width < minWidth) return str;
|
1553
|
-
|
1554
|
-
return wrap(str, width, indent);
|
1555
|
-
}
|
1556
|
-
|
1557
|
-
/**
|
1558
|
-
* Output help information if help flags specified
|
1559
|
-
*
|
1560
|
-
* @param {Command} cmd - command to output help for
|
1561
|
-
* @param {Array} options - array of options to search for -h or --help
|
1562
|
-
* @api private
|
1563
|
-
*/
|
1564
|
-
|
1565
|
-
function outputHelpIfRequested(cmd, options) {
|
1566
|
-
options = options || [];
|
1567
|
-
|
1568
|
-
for (var i = 0; i < options.length; i++) {
|
1569
|
-
if (options[i] === cmd._helpLongFlag || options[i] === cmd._helpShortFlag) {
|
1570
|
-
cmd.outputHelp();
|
1571
|
-
// (Do not have all displayed text available so only passing placeholder.)
|
1572
|
-
cmd._exit(0, 'commander.helpDisplayed', '(outputHelp)');
|
1573
|
-
}
|
1574
|
-
}
|
1575
|
-
}
|
1576
|
-
|
1577
|
-
/**
|
1578
|
-
* Takes an argument and returns its human readable equivalent for help usage.
|
1579
|
-
*
|
1580
|
-
* @param {Object} arg
|
1581
|
-
* @return {String}
|
1582
|
-
* @api private
|
1583
|
-
*/
|
1584
|
-
|
1585
|
-
function humanReadableArgName(arg) {
|
1586
|
-
var nameOutput = arg.name + (arg.variadic === true ? '...' : '');
|
1587
|
-
|
1588
|
-
return arg.required
|
1589
|
-
? '<' + nameOutput + '>'
|
1590
|
-
: '[' + nameOutput + ']';
|
1591
|
-
}
|
1592
|
-
|
1593
|
-
// for versions before node v0.8 when there weren't `fs.existsSync`
|
1594
|
-
function exists(file) {
|
1595
|
-
try {
|
1596
|
-
if (fs.statSync(file).isFile()) {
|
1597
|
-
return true;
|
1598
|
-
}
|
1599
|
-
} catch (e) {
|
1600
|
-
return false;
|
1601
|
-
}
|
1602
|
-
}
|
1603
|
-
|
1604
|
-
/**
|
1605
|
-
* Scan arguments and increment port number for inspect calls (to avoid conflicts when spawning new command).
|
1606
|
-
*
|
1607
|
-
* @param {string[]} args - array of arguments from node.execArgv
|
1608
|
-
* @returns {string[]}
|
1609
|
-
* @api private
|
1610
|
-
*/
|
1611
|
-
|
1612
|
-
function incrementNodeInspectorPort(args) {
|
1613
|
-
// Testing for these options:
|
1614
|
-
// --inspect[=[host:]port]
|
1615
|
-
// --inspect-brk[=[host:]port]
|
1616
|
-
// --inspect-port=[host:]port
|
1617
|
-
return args.map((arg) => {
|
1618
|
-
var result = arg;
|
1619
|
-
if (arg.indexOf('--inspect') === 0) {
|
1620
|
-
var debugOption;
|
1621
|
-
var debugHost = '127.0.0.1';
|
1622
|
-
var debugPort = '9229';
|
1623
|
-
var match;
|
1624
|
-
if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
|
1625
|
-
// e.g. --inspect
|
1626
|
-
debugOption = match[1];
|
1627
|
-
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
|
1628
|
-
debugOption = match[1];
|
1629
|
-
if (/^\d+$/.test(match[3])) {
|
1630
|
-
// e.g. --inspect=1234
|
1631
|
-
debugPort = match[3];
|
1632
|
-
} else {
|
1633
|
-
// e.g. --inspect=localhost
|
1634
|
-
debugHost = match[3];
|
1635
|
-
}
|
1636
|
-
} else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {
|
1637
|
-
// e.g. --inspect=localhost:1234
|
1638
|
-
debugOption = match[1];
|
1639
|
-
debugHost = match[3];
|
1640
|
-
debugPort = match[4];
|
1641
|
-
}
|
1642
|
-
|
1643
|
-
if (debugOption && debugPort !== '0') {
|
1644
|
-
result = `${debugOption}=${debugHost}:${parseInt(debugPort) + 1}`;
|
1645
|
-
}
|
1646
|
-
}
|
1647
|
-
return result;
|
1648
|
-
});
|
1649
|
-
}
|