@prismer/sdk 2.0.7 → 2.2.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -7
- package/dist/chunk-R7POPVJR.mjs +35 -0
- package/dist/cli.js +59723 -8280
- package/dist/index.d.mts +724 -229
- package/dist/index.d.ts +724 -229
- package/dist/index.js +325 -23
- package/dist/index.mjs +324 -23
- package/dist/katex-OIP2Q473.mjs +14515 -0
- package/dist/pkf-schema.json +35 -0
- package/dist/pkf.d.mts +1 -0
- package/dist/pkf.d.ts +1 -0
- package/dist/pkf.js +48370 -0
- package/dist/pkf.mjs +33683 -0
- package/node_modules/@clack/core/CHANGELOG.md +249 -0
- package/node_modules/@clack/core/LICENSE +9 -0
- package/node_modules/@clack/core/README.md +22 -0
- package/node_modules/@clack/core/dist/index.cjs +15 -0
- package/node_modules/@clack/core/dist/index.cjs.map +1 -0
- package/node_modules/@clack/core/dist/index.d.cts +209 -0
- package/node_modules/@clack/core/dist/index.d.mts +209 -0
- package/node_modules/@clack/core/dist/index.d.ts +209 -0
- package/node_modules/@clack/core/dist/index.mjs +15 -0
- package/node_modules/@clack/core/dist/index.mjs.map +1 -0
- package/node_modules/@clack/core/package.json +62 -0
- package/node_modules/@clack/prompts/CHANGELOG.md +374 -0
- package/node_modules/@clack/prompts/LICENSE +9 -0
- package/node_modules/@clack/prompts/README.md +191 -0
- package/node_modules/@clack/prompts/dist/index.cjs +80 -0
- package/node_modules/@clack/prompts/dist/index.cjs.map +1 -0
- package/node_modules/@clack/prompts/dist/index.d.cts +151 -0
- package/node_modules/@clack/prompts/dist/index.d.mts +151 -0
- package/node_modules/@clack/prompts/dist/index.d.ts +151 -0
- package/node_modules/@clack/prompts/dist/index.mjs +80 -0
- package/node_modules/@clack/prompts/dist/index.mjs.map +1 -0
- package/node_modules/@clack/prompts/package.json +61 -0
- package/node_modules/@iarna/toml/LICENSE +14 -0
- package/node_modules/@iarna/toml/README.md +301 -0
- package/node_modules/@iarna/toml/index.d.ts +57 -0
- package/node_modules/@iarna/toml/lib/create-date.js +23 -0
- package/node_modules/@iarna/toml/lib/create-datetime-float.js +24 -0
- package/node_modules/@iarna/toml/lib/create-datetime.js +10 -0
- package/node_modules/@iarna/toml/lib/create-time.js +22 -0
- package/node_modules/@iarna/toml/lib/format-num.js +6 -0
- package/node_modules/@iarna/toml/lib/parser-debug.js +60 -0
- package/node_modules/@iarna/toml/lib/parser.js +127 -0
- package/node_modules/@iarna/toml/lib/toml-parser.js +1379 -0
- package/node_modules/@iarna/toml/package.json +82 -0
- package/node_modules/@iarna/toml/parse-async.js +30 -0
- package/node_modules/@iarna/toml/parse-pretty-error.js +33 -0
- package/node_modules/@iarna/toml/parse-stream.js +80 -0
- package/node_modules/@iarna/toml/parse-string.js +18 -0
- package/node_modules/@iarna/toml/parse.js +5 -0
- package/node_modules/@iarna/toml/stringify.js +296 -0
- package/node_modules/@iarna/toml/toml.js +3 -0
- package/node_modules/@prismer/aip-sdk/README.md +36 -0
- package/node_modules/@prismer/aip-sdk/dist/cli/chunk-LIJDUCHB.js +104 -0
- package/node_modules/@prismer/aip-sdk/dist/cli/chunk-QUQXZ2LD.js +99 -0
- package/node_modules/@prismer/aip-sdk/dist/cli/credentials-5GGZEJFG.js +56 -0
- package/node_modules/@prismer/aip-sdk/dist/cli/delegation-3J35VGBZ.js +64 -0
- package/node_modules/@prismer/aip-sdk/dist/cli/identity-LXVWKSVB.js +7 -0
- package/node_modules/@prismer/aip-sdk/dist/cli/index.js +259 -0
- package/node_modules/@prismer/aip-sdk/dist/cli/resolver-TGOPKW52.js +26 -0
- package/node_modules/@prismer/aip-sdk/dist/index.cjs +368 -0
- package/node_modules/@prismer/aip-sdk/dist/index.d.cts +174 -0
- package/node_modules/@prismer/aip-sdk/dist/index.d.ts +174 -0
- package/node_modules/@prismer/aip-sdk/dist/index.js +322 -0
- package/node_modules/@prismer/aip-sdk/package.json +53 -0
- package/node_modules/ansi-regex/index.d.ts +37 -0
- package/node_modules/ansi-regex/index.js +10 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +55 -0
- package/node_modules/ansi-regex/readme.md +78 -0
- package/node_modules/camelcase/index.d.ts +63 -0
- package/node_modules/camelcase/index.js +76 -0
- package/node_modules/camelcase/license +9 -0
- package/node_modules/camelcase/package.json +43 -0
- package/node_modules/camelcase/readme.md +99 -0
- package/node_modules/cliui/LICENSE.txt +14 -0
- package/node_modules/cliui/README.md +115 -0
- package/node_modules/cliui/index.js +354 -0
- package/node_modules/cliui/package.json +65 -0
- package/node_modules/color-convert/LICENSE +21 -0
- package/node_modules/color-convert/README.md +68 -0
- package/node_modules/color-convert/conversions.js +839 -0
- package/node_modules/color-convert/index.js +81 -0
- package/node_modules/color-convert/package.json +48 -0
- package/node_modules/color-convert/route.js +97 -0
- package/node_modules/color-name/LICENSE +8 -0
- package/node_modules/color-name/README.md +11 -0
- package/node_modules/color-name/index.js +152 -0
- package/node_modules/color-name/package.json +28 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1157 -0
- package/node_modules/commander/esm.mjs +16 -0
- package/node_modules/commander/index.js +24 -0
- package/node_modules/commander/lib/argument.js +149 -0
- package/node_modules/commander/lib/command.js +2509 -0
- package/node_modules/commander/lib/error.js +39 -0
- package/node_modules/commander/lib/help.js +520 -0
- package/node_modules/commander/lib/option.js +330 -0
- package/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/node_modules/commander/package-support.json +16 -0
- package/node_modules/commander/package.json +84 -0
- package/node_modules/commander/typings/esm.d.mts +3 -0
- package/node_modules/commander/typings/index.d.ts +969 -0
- package/node_modules/decamelize/index.js +13 -0
- package/node_modules/decamelize/license +21 -0
- package/node_modules/decamelize/package.json +38 -0
- package/node_modules/decamelize/readme.md +48 -0
- package/node_modules/dijkstrajs/.travis.yml +4 -0
- package/node_modules/dijkstrajs/CONTRIBUTING.md +8 -0
- package/node_modules/dijkstrajs/LICENSE.md +19 -0
- package/node_modules/dijkstrajs/README.md +18 -0
- package/node_modules/dijkstrajs/dijkstra.js +165 -0
- package/node_modules/dijkstrajs/package.json +60 -0
- package/node_modules/dijkstrajs/test/dijkstra.test.js +96 -0
- package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/emoji-regex/README.md +73 -0
- package/node_modules/emoji-regex/es2015/index.js +6 -0
- package/node_modules/emoji-regex/es2015/text.js +6 -0
- package/node_modules/emoji-regex/index.d.ts +23 -0
- package/node_modules/emoji-regex/index.js +6 -0
- package/node_modules/emoji-regex/package.json +50 -0
- package/node_modules/emoji-regex/text.js +6 -0
- package/node_modules/find-up/index.d.ts +137 -0
- package/node_modules/find-up/index.js +89 -0
- package/node_modules/find-up/license +9 -0
- package/node_modules/find-up/package.json +53 -0
- package/node_modules/find-up/readme.md +156 -0
- package/node_modules/get-caller-file/LICENSE.md +6 -0
- package/node_modules/get-caller-file/README.md +41 -0
- package/node_modules/get-caller-file/index.d.ts +2 -0
- package/node_modules/get-caller-file/index.js +22 -0
- package/node_modules/get-caller-file/index.js.map +1 -0
- package/node_modules/get-caller-file/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/node_modules/is-fullwidth-code-point/index.js +50 -0
- package/node_modules/is-fullwidth-code-point/license +9 -0
- package/node_modules/is-fullwidth-code-point/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/readme.md +39 -0
- package/node_modules/locate-path/index.d.ts +83 -0
- package/node_modules/locate-path/index.js +65 -0
- package/node_modules/locate-path/license +9 -0
- package/node_modules/locate-path/package.json +45 -0
- package/node_modules/locate-path/readme.md +122 -0
- package/node_modules/p-locate/index.d.ts +64 -0
- package/node_modules/p-locate/index.js +52 -0
- package/node_modules/p-locate/license +9 -0
- package/node_modules/p-locate/node_modules/p-limit/index.d.ts +38 -0
- package/node_modules/p-locate/node_modules/p-limit/index.js +57 -0
- package/node_modules/p-locate/node_modules/p-limit/license +9 -0
- package/node_modules/p-locate/node_modules/p-limit/package.json +52 -0
- package/node_modules/p-locate/node_modules/p-limit/readme.md +101 -0
- package/node_modules/p-locate/package.json +53 -0
- package/node_modules/p-locate/readme.md +90 -0
- package/node_modules/p-try/index.d.ts +39 -0
- package/node_modules/p-try/index.js +9 -0
- package/node_modules/p-try/license +9 -0
- package/node_modules/p-try/package.json +42 -0
- package/node_modules/p-try/readme.md +58 -0
- package/node_modules/path-exists/index.d.ts +28 -0
- package/node_modules/path-exists/index.js +23 -0
- package/node_modules/path-exists/license +9 -0
- package/node_modules/path-exists/package.json +39 -0
- package/node_modules/path-exists/readme.md +52 -0
- package/node_modules/picocolors/LICENSE +15 -0
- package/node_modules/picocolors/README.md +21 -0
- package/node_modules/picocolors/package.json +25 -0
- package/node_modules/picocolors/picocolors.browser.js +4 -0
- package/node_modules/picocolors/picocolors.d.ts +5 -0
- package/node_modules/picocolors/picocolors.js +75 -0
- package/node_modules/picocolors/types.d.ts +51 -0
- package/node_modules/pngjs/.eslintignore +2 -0
- package/node_modules/pngjs/.eslintrc.json +19 -0
- package/node_modules/pngjs/.prettierignore +3 -0
- package/node_modules/pngjs/LICENSE +20 -0
- package/node_modules/pngjs/README.md +429 -0
- package/node_modules/pngjs/browser.js +16096 -0
- package/node_modules/pngjs/coverage/lcov-report/base.css +354 -0
- package/node_modules/pngjs/coverage/lcov-report/bitmapper.js.html +881 -0
- package/node_modules/pngjs/coverage/lcov-report/bitpacker.js.html +554 -0
- package/node_modules/pngjs/coverage/lcov-report/block-navigation.js +77 -0
- package/node_modules/pngjs/coverage/lcov-report/chunkstream.js.html +647 -0
- package/node_modules/pngjs/coverage/lcov-report/constants.js.html +176 -0
- package/node_modules/pngjs/coverage/lcov-report/crc.js.html +200 -0
- package/node_modules/pngjs/coverage/lcov-report/favicon.png +0 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-pack.js.html +593 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse-async.js.html +152 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse-sync.js.html +143 -0
- package/node_modules/pngjs/coverage/lcov-report/filter-parse.js.html +611 -0
- package/node_modules/pngjs/coverage/lcov-report/format-normaliser.js.html +359 -0
- package/node_modules/pngjs/coverage/lcov-report/index.html +426 -0
- package/node_modules/pngjs/coverage/lcov-report/interlace.js.html +365 -0
- package/node_modules/pngjs/coverage/lcov-report/packer-async.js.html +230 -0
- package/node_modules/pngjs/coverage/lcov-report/packer-sync.js.html +248 -0
- package/node_modules/pngjs/coverage/lcov-report/packer.js.html +467 -0
- package/node_modules/pngjs/coverage/lcov-report/paeth-predictor.js.html +128 -0
- package/node_modules/pngjs/coverage/lcov-report/parser-async.js.html +575 -0
- package/node_modules/pngjs/coverage/lcov-report/parser-sync.js.html +404 -0
- package/node_modules/pngjs/coverage/lcov-report/parser.js.html +950 -0
- package/node_modules/pngjs/coverage/lcov-report/png-sync.js.html +116 -0
- package/node_modules/pngjs/coverage/lcov-report/png.js.html +662 -0
- package/node_modules/pngjs/coverage/lcov-report/prettify.css +101 -0
- package/node_modules/pngjs/coverage/lcov-report/prettify.js +1007 -0
- package/node_modules/pngjs/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/node_modules/pngjs/coverage/lcov-report/sorter.js +169 -0
- package/node_modules/pngjs/coverage/lcov-report/sync-inflate.js.html +584 -0
- package/node_modules/pngjs/coverage/lcov-report/sync-reader.js.html +215 -0
- package/node_modules/pngjs/coverage/lcov.info +2177 -0
- package/node_modules/pngjs/lib/bitmapper.js +267 -0
- package/node_modules/pngjs/lib/bitpacker.js +158 -0
- package/node_modules/pngjs/lib/chunkstream.js +189 -0
- package/node_modules/pngjs/lib/constants.js +32 -0
- package/node_modules/pngjs/lib/crc.js +40 -0
- package/node_modules/pngjs/lib/filter-pack.js +171 -0
- package/node_modules/pngjs/lib/filter-parse-async.js +24 -0
- package/node_modules/pngjs/lib/filter-parse-sync.js +21 -0
- package/node_modules/pngjs/lib/filter-parse.js +177 -0
- package/node_modules/pngjs/lib/format-normaliser.js +93 -0
- package/node_modules/pngjs/lib/interlace.js +95 -0
- package/node_modules/pngjs/lib/packer-async.js +50 -0
- package/node_modules/pngjs/lib/packer-sync.js +56 -0
- package/node_modules/pngjs/lib/packer.js +129 -0
- package/node_modules/pngjs/lib/paeth-predictor.js +16 -0
- package/node_modules/pngjs/lib/parser-async.js +165 -0
- package/node_modules/pngjs/lib/parser-sync.js +108 -0
- package/node_modules/pngjs/lib/parser.js +290 -0
- package/node_modules/pngjs/lib/png-sync.js +12 -0
- package/node_modules/pngjs/lib/png.js +194 -0
- package/node_modules/pngjs/lib/sync-inflate.js +168 -0
- package/node_modules/pngjs/lib/sync-reader.js +45 -0
- package/node_modules/pngjs/package.json +73 -0
- package/node_modules/qrcode/README.md +770 -0
- package/node_modules/qrcode/bin/qrcode +159 -0
- package/node_modules/qrcode/helper/to-sjis-browser.js +2 -0
- package/node_modules/qrcode/helper/to-sjis.js +105 -0
- package/node_modules/qrcode/lib/browser.js +76 -0
- package/node_modules/qrcode/lib/can-promise.js +7 -0
- package/node_modules/qrcode/lib/core/alignment-pattern.js +83 -0
- package/node_modules/qrcode/lib/core/alphanumeric-data.js +59 -0
- package/node_modules/qrcode/lib/core/bit-buffer.js +37 -0
- package/node_modules/qrcode/lib/core/bit-matrix.js +65 -0
- package/node_modules/qrcode/lib/core/byte-data.js +30 -0
- package/node_modules/qrcode/lib/core/error-correction-code.js +135 -0
- package/node_modules/qrcode/lib/core/error-correction-level.js +50 -0
- package/node_modules/qrcode/lib/core/finder-pattern.js +22 -0
- package/node_modules/qrcode/lib/core/format-info.js +29 -0
- package/node_modules/qrcode/lib/core/galois-field.js +69 -0
- package/node_modules/qrcode/lib/core/kanji-data.js +54 -0
- package/node_modules/qrcode/lib/core/mask-pattern.js +234 -0
- package/node_modules/qrcode/lib/core/mode.js +167 -0
- package/node_modules/qrcode/lib/core/numeric-data.js +43 -0
- package/node_modules/qrcode/lib/core/polynomial.js +62 -0
- package/node_modules/qrcode/lib/core/qrcode.js +495 -0
- package/node_modules/qrcode/lib/core/reed-solomon-encoder.js +56 -0
- package/node_modules/qrcode/lib/core/regex.js +31 -0
- package/node_modules/qrcode/lib/core/segments.js +330 -0
- package/node_modules/qrcode/lib/core/utils.js +63 -0
- package/node_modules/qrcode/lib/core/version-check.js +9 -0
- package/node_modules/qrcode/lib/core/version.js +163 -0
- package/node_modules/qrcode/lib/index.js +12 -0
- package/node_modules/qrcode/lib/renderer/canvas.js +63 -0
- package/node_modules/qrcode/lib/renderer/png.js +78 -0
- package/node_modules/qrcode/lib/renderer/svg-tag.js +81 -0
- package/node_modules/qrcode/lib/renderer/svg.js +19 -0
- package/node_modules/qrcode/lib/renderer/terminal/terminal-small.js +85 -0
- package/node_modules/qrcode/lib/renderer/terminal/terminal.js +49 -0
- package/node_modules/qrcode/lib/renderer/terminal.js +9 -0
- package/node_modules/qrcode/lib/renderer/utf8.js +71 -0
- package/node_modules/qrcode/lib/renderer/utils.js +99 -0
- package/node_modules/qrcode/lib/server.js +138 -0
- package/node_modules/qrcode/license +10 -0
- package/node_modules/qrcode/package.json +77 -0
- package/node_modules/require-directory/.jshintrc +67 -0
- package/node_modules/require-directory/.npmignore +1 -0
- package/node_modules/require-directory/.travis.yml +3 -0
- package/node_modules/require-directory/LICENSE +22 -0
- package/node_modules/require-directory/README.markdown +184 -0
- package/node_modules/require-directory/index.js +86 -0
- package/node_modules/require-directory/package.json +40 -0
- package/node_modules/require-main-filename/LICENSE.txt +14 -0
- package/node_modules/require-main-filename/README.md +26 -0
- package/node_modules/require-main-filename/index.js +18 -0
- package/node_modules/require-main-filename/package.json +35 -0
- package/node_modules/set-blocking/LICENSE.txt +14 -0
- package/node_modules/set-blocking/README.md +31 -0
- package/node_modules/set-blocking/index.js +7 -0
- package/node_modules/set-blocking/package.json +42 -0
- package/node_modules/sisteransi/license +21 -0
- package/node_modules/sisteransi/package.json +34 -0
- package/node_modules/sisteransi/readme.md +113 -0
- package/node_modules/sisteransi/src/index.js +58 -0
- package/node_modules/sisteransi/src/sisteransi.d.ts +35 -0
- package/node_modules/string-width/index.d.ts +29 -0
- package/node_modules/string-width/index.js +47 -0
- package/node_modules/string-width/license +9 -0
- package/node_modules/string-width/package.json +56 -0
- package/node_modules/string-width/readme.md +50 -0
- package/node_modules/strip-ansi/index.d.ts +17 -0
- package/node_modules/strip-ansi/index.js +4 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +54 -0
- package/node_modules/strip-ansi/readme.md +46 -0
- package/node_modules/which-module/LICENSE +13 -0
- package/node_modules/which-module/README.md +58 -0
- package/node_modules/which-module/index.js +9 -0
- package/node_modules/which-module/package.json +41 -0
- package/node_modules/wrap-ansi/index.js +186 -0
- package/node_modules/wrap-ansi/license +9 -0
- package/node_modules/wrap-ansi/node_modules/ansi-styles/index.d.ts +345 -0
- package/node_modules/wrap-ansi/node_modules/ansi-styles/index.js +163 -0
- package/node_modules/wrap-ansi/node_modules/ansi-styles/license +9 -0
- package/node_modules/wrap-ansi/node_modules/ansi-styles/package.json +56 -0
- package/node_modules/wrap-ansi/node_modules/ansi-styles/readme.md +152 -0
- package/node_modules/wrap-ansi/package.json +61 -0
- package/node_modules/wrap-ansi/readme.md +97 -0
- package/node_modules/y18n/LICENSE +13 -0
- package/node_modules/y18n/README.md +109 -0
- package/node_modules/y18n/index.js +188 -0
- package/node_modules/y18n/package.json +39 -0
- package/node_modules/yargs/LICENSE +21 -0
- package/node_modules/yargs/README.md +140 -0
- package/node_modules/yargs/build/lib/apply-extends.d.ts +2 -0
- package/node_modules/yargs/build/lib/apply-extends.js +65 -0
- package/node_modules/yargs/build/lib/argsert.d.ts +2 -0
- package/node_modules/yargs/build/lib/argsert.js +65 -0
- package/node_modules/yargs/build/lib/command.d.ts +64 -0
- package/node_modules/yargs/build/lib/command.js +416 -0
- package/node_modules/yargs/build/lib/common-types.d.ts +36 -0
- package/node_modules/yargs/build/lib/common-types.js +25 -0
- package/node_modules/yargs/build/lib/completion-templates.d.ts +2 -0
- package/node_modules/yargs/build/lib/completion-templates.js +50 -0
- package/node_modules/yargs/build/lib/completion.d.ts +21 -0
- package/node_modules/yargs/build/lib/completion.js +135 -0
- package/node_modules/yargs/build/lib/is-promise.d.ts +1 -0
- package/node_modules/yargs/build/lib/is-promise.js +9 -0
- package/node_modules/yargs/build/lib/levenshtein.d.ts +1 -0
- package/node_modules/yargs/build/lib/levenshtein.js +58 -0
- package/node_modules/yargs/build/lib/middleware.d.ts +10 -0
- package/node_modules/yargs/build/lib/middleware.js +57 -0
- package/node_modules/yargs/build/lib/obj-filter.d.ts +1 -0
- package/node_modules/yargs/build/lib/obj-filter.js +14 -0
- package/node_modules/yargs/build/lib/parse-command.d.ts +11 -0
- package/node_modules/yargs/build/lib/parse-command.js +36 -0
- package/node_modules/yargs/build/lib/process-argv.d.ts +2 -0
- package/node_modules/yargs/build/lib/process-argv.js +31 -0
- package/node_modules/yargs/build/lib/usage.d.ts +49 -0
- package/node_modules/yargs/build/lib/usage.js +540 -0
- package/node_modules/yargs/build/lib/validation.d.ts +34 -0
- package/node_modules/yargs/build/lib/validation.js +330 -0
- package/node_modules/yargs/build/lib/yargs.d.ts +274 -0
- package/node_modules/yargs/build/lib/yargs.js +1190 -0
- package/node_modules/yargs/build/lib/yerror.d.ts +4 -0
- package/node_modules/yargs/build/lib/yerror.js +11 -0
- package/node_modules/yargs/index.js +40 -0
- package/node_modules/yargs/locales/be.json +46 -0
- package/node_modules/yargs/locales/de.json +46 -0
- package/node_modules/yargs/locales/en.json +51 -0
- package/node_modules/yargs/locales/es.json +46 -0
- package/node_modules/yargs/locales/fi.json +49 -0
- package/node_modules/yargs/locales/fr.json +53 -0
- package/node_modules/yargs/locales/hi.json +49 -0
- package/node_modules/yargs/locales/hu.json +46 -0
- package/node_modules/yargs/locales/id.json +50 -0
- package/node_modules/yargs/locales/it.json +46 -0
- package/node_modules/yargs/locales/ja.json +51 -0
- package/node_modules/yargs/locales/ko.json +49 -0
- package/node_modules/yargs/locales/nb.json +44 -0
- package/node_modules/yargs/locales/nl.json +49 -0
- package/node_modules/yargs/locales/nn.json +44 -0
- package/node_modules/yargs/locales/pirate.json +13 -0
- package/node_modules/yargs/locales/pl.json +49 -0
- package/node_modules/yargs/locales/pt.json +45 -0
- package/node_modules/yargs/locales/pt_BR.json +48 -0
- package/node_modules/yargs/locales/ru.json +46 -0
- package/node_modules/yargs/locales/th.json +46 -0
- package/node_modules/yargs/locales/tr.json +48 -0
- package/node_modules/yargs/locales/zh_CN.json +48 -0
- package/node_modules/yargs/locales/zh_TW.json +47 -0
- package/node_modules/yargs/package.json +92 -0
- package/node_modules/yargs/yargs.js +14 -0
- package/node_modules/yargs-parser/LICENSE.txt +14 -0
- package/node_modules/yargs-parser/README.md +449 -0
- package/node_modules/yargs-parser/index.js +1032 -0
- package/node_modules/yargs-parser/lib/tokenize-arg-string.js +40 -0
- package/node_modules/yargs-parser/package.json +46 -0
- package/package.json +28 -5
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usage = void 0;
|
|
4
|
+
// this file handles outputting usage instructions,
|
|
5
|
+
// failures, etc. keeps logging in one place.
|
|
6
|
+
const common_types_1 = require("./common-types");
|
|
7
|
+
const obj_filter_1 = require("./obj-filter");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const yerror_1 = require("./yerror");
|
|
10
|
+
const decamelize = require("decamelize");
|
|
11
|
+
const setBlocking = require("set-blocking");
|
|
12
|
+
const stringWidth = require("string-width");
|
|
13
|
+
function usage(yargs, y18n) {
|
|
14
|
+
const __ = y18n.__;
|
|
15
|
+
const self = {};
|
|
16
|
+
// methods for ouputting/building failure message.
|
|
17
|
+
const fails = [];
|
|
18
|
+
self.failFn = function failFn(f) {
|
|
19
|
+
fails.push(f);
|
|
20
|
+
};
|
|
21
|
+
let failMessage = null;
|
|
22
|
+
let showHelpOnFail = true;
|
|
23
|
+
self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) {
|
|
24
|
+
function parseFunctionArgs() {
|
|
25
|
+
return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2];
|
|
26
|
+
}
|
|
27
|
+
const [enabled, message] = parseFunctionArgs();
|
|
28
|
+
failMessage = message;
|
|
29
|
+
showHelpOnFail = enabled;
|
|
30
|
+
return self;
|
|
31
|
+
};
|
|
32
|
+
let failureOutput = false;
|
|
33
|
+
self.fail = function fail(msg, err) {
|
|
34
|
+
const logger = yargs._getLoggerInstance();
|
|
35
|
+
if (fails.length) {
|
|
36
|
+
for (let i = fails.length - 1; i >= 0; --i) {
|
|
37
|
+
fails[i](msg, err, self);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (yargs.getExitProcess())
|
|
42
|
+
setBlocking(true);
|
|
43
|
+
// don't output failure message more than once
|
|
44
|
+
if (!failureOutput) {
|
|
45
|
+
failureOutput = true;
|
|
46
|
+
if (showHelpOnFail) {
|
|
47
|
+
yargs.showHelp('error');
|
|
48
|
+
logger.error();
|
|
49
|
+
}
|
|
50
|
+
if (msg || err)
|
|
51
|
+
logger.error(msg || err);
|
|
52
|
+
if (failMessage) {
|
|
53
|
+
if (msg || err)
|
|
54
|
+
logger.error('');
|
|
55
|
+
logger.error(failMessage);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
err = err || new yerror_1.YError(msg);
|
|
59
|
+
if (yargs.getExitProcess()) {
|
|
60
|
+
return yargs.exit(1);
|
|
61
|
+
}
|
|
62
|
+
else if (yargs._hasParseCallback()) {
|
|
63
|
+
return yargs.exit(1, err);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
throw err;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
// methods for ouputting/building help (usage) message.
|
|
71
|
+
let usages = [];
|
|
72
|
+
let usageDisabled = false;
|
|
73
|
+
self.usage = (msg, description) => {
|
|
74
|
+
if (msg === null) {
|
|
75
|
+
usageDisabled = true;
|
|
76
|
+
usages = [];
|
|
77
|
+
return self;
|
|
78
|
+
}
|
|
79
|
+
usageDisabled = false;
|
|
80
|
+
usages.push([msg, description || '']);
|
|
81
|
+
return self;
|
|
82
|
+
};
|
|
83
|
+
self.getUsage = () => {
|
|
84
|
+
return usages;
|
|
85
|
+
};
|
|
86
|
+
self.getUsageDisabled = () => {
|
|
87
|
+
return usageDisabled;
|
|
88
|
+
};
|
|
89
|
+
self.getPositionalGroupName = () => {
|
|
90
|
+
return __('Positionals:');
|
|
91
|
+
};
|
|
92
|
+
let examples = [];
|
|
93
|
+
self.example = (cmd, description) => {
|
|
94
|
+
examples.push([cmd, description || '']);
|
|
95
|
+
};
|
|
96
|
+
let commands = [];
|
|
97
|
+
self.command = function command(cmd, description, isDefault, aliases, deprecated = false) {
|
|
98
|
+
// the last default wins, so cancel out any previously set default
|
|
99
|
+
if (isDefault) {
|
|
100
|
+
commands = commands.map((cmdArray) => {
|
|
101
|
+
cmdArray[2] = false;
|
|
102
|
+
return cmdArray;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
commands.push([cmd, description || '', isDefault, aliases, deprecated]);
|
|
106
|
+
};
|
|
107
|
+
self.getCommands = () => commands;
|
|
108
|
+
let descriptions = {};
|
|
109
|
+
self.describe = function describe(keyOrKeys, desc) {
|
|
110
|
+
if (Array.isArray(keyOrKeys)) {
|
|
111
|
+
keyOrKeys.forEach((k) => {
|
|
112
|
+
self.describe(k, desc);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
else if (typeof keyOrKeys === 'object') {
|
|
116
|
+
Object.keys(keyOrKeys).forEach((k) => {
|
|
117
|
+
self.describe(k, keyOrKeys[k]);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
descriptions[keyOrKeys] = desc;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
self.getDescriptions = () => descriptions;
|
|
125
|
+
let epilogs = [];
|
|
126
|
+
self.epilog = (msg) => {
|
|
127
|
+
epilogs.push(msg);
|
|
128
|
+
};
|
|
129
|
+
let wrapSet = false;
|
|
130
|
+
let wrap;
|
|
131
|
+
self.wrap = (cols) => {
|
|
132
|
+
wrapSet = true;
|
|
133
|
+
wrap = cols;
|
|
134
|
+
};
|
|
135
|
+
function getWrap() {
|
|
136
|
+
if (!wrapSet) {
|
|
137
|
+
wrap = windowWidth();
|
|
138
|
+
wrapSet = true;
|
|
139
|
+
}
|
|
140
|
+
return wrap;
|
|
141
|
+
}
|
|
142
|
+
const deferY18nLookupPrefix = '__yargsString__:';
|
|
143
|
+
self.deferY18nLookup = str => deferY18nLookupPrefix + str;
|
|
144
|
+
self.help = function help() {
|
|
145
|
+
if (cachedHelpMessage)
|
|
146
|
+
return cachedHelpMessage;
|
|
147
|
+
normalizeAliases();
|
|
148
|
+
// handle old demanded API
|
|
149
|
+
const base$0 = yargs.customScriptName ? yargs.$0 : path.basename(yargs.$0);
|
|
150
|
+
const demandedOptions = yargs.getDemandedOptions();
|
|
151
|
+
const demandedCommands = yargs.getDemandedCommands();
|
|
152
|
+
const deprecatedOptions = yargs.getDeprecatedOptions();
|
|
153
|
+
const groups = yargs.getGroups();
|
|
154
|
+
const options = yargs.getOptions();
|
|
155
|
+
let keys = [];
|
|
156
|
+
keys = keys.concat(Object.keys(descriptions));
|
|
157
|
+
keys = keys.concat(Object.keys(demandedOptions));
|
|
158
|
+
keys = keys.concat(Object.keys(demandedCommands));
|
|
159
|
+
keys = keys.concat(Object.keys(options.default));
|
|
160
|
+
keys = keys.filter(filterHiddenOptions);
|
|
161
|
+
keys = Object.keys(keys.reduce((acc, key) => {
|
|
162
|
+
if (key !== '_')
|
|
163
|
+
acc[key] = true;
|
|
164
|
+
return acc;
|
|
165
|
+
}, {}));
|
|
166
|
+
const theWrap = getWrap();
|
|
167
|
+
const ui = require('cliui')({
|
|
168
|
+
width: theWrap,
|
|
169
|
+
wrap: !!theWrap
|
|
170
|
+
});
|
|
171
|
+
// the usage string.
|
|
172
|
+
if (!usageDisabled) {
|
|
173
|
+
if (usages.length) {
|
|
174
|
+
// user-defined usage.
|
|
175
|
+
usages.forEach((usage) => {
|
|
176
|
+
ui.div(`${usage[0].replace(/\$0/g, base$0)}`);
|
|
177
|
+
if (usage[1]) {
|
|
178
|
+
ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] });
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
ui.div();
|
|
182
|
+
}
|
|
183
|
+
else if (commands.length) {
|
|
184
|
+
let u = null;
|
|
185
|
+
// demonstrate how commands are used.
|
|
186
|
+
if (demandedCommands._) {
|
|
187
|
+
u = `${base$0} <${__('command')}>\n`;
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
u = `${base$0} [${__('command')}]\n`;
|
|
191
|
+
}
|
|
192
|
+
ui.div(`${u}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// your application's commands, i.e., non-option
|
|
196
|
+
// arguments populated in '_'.
|
|
197
|
+
if (commands.length) {
|
|
198
|
+
ui.div(__('Commands:'));
|
|
199
|
+
const context = yargs.getContext();
|
|
200
|
+
const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : '';
|
|
201
|
+
if (yargs.getParserConfiguration()['sort-commands'] === true) {
|
|
202
|
+
commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
|
|
203
|
+
}
|
|
204
|
+
commands.forEach((command) => {
|
|
205
|
+
const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}`; // drop $0 from default commands.
|
|
206
|
+
ui.span({
|
|
207
|
+
text: commandString,
|
|
208
|
+
padding: [0, 2, 0, 2],
|
|
209
|
+
width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
|
|
210
|
+
}, { text: command[1] });
|
|
211
|
+
const hints = [];
|
|
212
|
+
if (command[2])
|
|
213
|
+
hints.push(`[${__('default')}]`);
|
|
214
|
+
if (command[3] && command[3].length) {
|
|
215
|
+
hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`);
|
|
216
|
+
}
|
|
217
|
+
if (command[4]) {
|
|
218
|
+
if (typeof command[4] === 'string') {
|
|
219
|
+
hints.push(`[${__('deprecated: %s', command[4])}]`);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
hints.push(`[${__('deprecated')}]`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (hints.length) {
|
|
226
|
+
ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' });
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
ui.div();
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
ui.div();
|
|
233
|
+
}
|
|
234
|
+
// perform some cleanup on the keys array, making it
|
|
235
|
+
// only include top-level keys not their aliases.
|
|
236
|
+
const aliasKeys = (Object.keys(options.alias) || [])
|
|
237
|
+
.concat(Object.keys(yargs.parsed.newAliases) || []);
|
|
238
|
+
keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1));
|
|
239
|
+
// populate 'Options:' group with any keys that have not
|
|
240
|
+
// explicitly had a group set.
|
|
241
|
+
const defaultGroup = __('Options:');
|
|
242
|
+
if (!groups[defaultGroup])
|
|
243
|
+
groups[defaultGroup] = [];
|
|
244
|
+
addUngroupedKeys(keys, options.alias, groups, defaultGroup);
|
|
245
|
+
// display 'Options:' table along with any custom tables:
|
|
246
|
+
Object.keys(groups).forEach((groupName) => {
|
|
247
|
+
if (!groups[groupName].length)
|
|
248
|
+
return;
|
|
249
|
+
// if we've grouped the key 'f', but 'f' aliases 'foobar',
|
|
250
|
+
// normalizedKeys should contain only 'foobar'.
|
|
251
|
+
const normalizedKeys = groups[groupName].filter(filterHiddenOptions).map((key) => {
|
|
252
|
+
if (~aliasKeys.indexOf(key))
|
|
253
|
+
return key;
|
|
254
|
+
for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
|
|
255
|
+
if (~(options.alias[aliasKey] || []).indexOf(key))
|
|
256
|
+
return aliasKey;
|
|
257
|
+
}
|
|
258
|
+
return key;
|
|
259
|
+
});
|
|
260
|
+
if (normalizedKeys.length < 1)
|
|
261
|
+
return;
|
|
262
|
+
ui.div(groupName);
|
|
263
|
+
// actually generate the switches string --foo, -f, --bar.
|
|
264
|
+
const switches = normalizedKeys.reduce((acc, key) => {
|
|
265
|
+
acc[key] = [key].concat(options.alias[key] || [])
|
|
266
|
+
.map(sw => {
|
|
267
|
+
// for the special positional group don't
|
|
268
|
+
// add '--' or '-' prefix.
|
|
269
|
+
if (groupName === self.getPositionalGroupName())
|
|
270
|
+
return sw;
|
|
271
|
+
else {
|
|
272
|
+
return (
|
|
273
|
+
// matches yargs-parser logic in which single-digits
|
|
274
|
+
// aliases declared with a boolean type are now valid
|
|
275
|
+
/^[0-9]$/.test(sw)
|
|
276
|
+
? ~options.boolean.indexOf(key) ? '-' : '--'
|
|
277
|
+
: sw.length > 1 ? '--' : '-') + sw;
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
.join(', ');
|
|
281
|
+
return acc;
|
|
282
|
+
}, {});
|
|
283
|
+
normalizedKeys.forEach((key) => {
|
|
284
|
+
const kswitch = switches[key];
|
|
285
|
+
let desc = descriptions[key] || '';
|
|
286
|
+
let type = null;
|
|
287
|
+
if (~desc.lastIndexOf(deferY18nLookupPrefix))
|
|
288
|
+
desc = __(desc.substring(deferY18nLookupPrefix.length));
|
|
289
|
+
if (~options.boolean.indexOf(key))
|
|
290
|
+
type = `[${__('boolean')}]`;
|
|
291
|
+
if (~options.count.indexOf(key))
|
|
292
|
+
type = `[${__('count')}]`;
|
|
293
|
+
if (~options.string.indexOf(key))
|
|
294
|
+
type = `[${__('string')}]`;
|
|
295
|
+
if (~options.normalize.indexOf(key))
|
|
296
|
+
type = `[${__('string')}]`;
|
|
297
|
+
if (~options.array.indexOf(key))
|
|
298
|
+
type = `[${__('array')}]`;
|
|
299
|
+
if (~options.number.indexOf(key))
|
|
300
|
+
type = `[${__('number')}]`;
|
|
301
|
+
const deprecatedExtra = (deprecated) => typeof deprecated === 'string'
|
|
302
|
+
? `[${__('deprecated: %s', deprecated)}]`
|
|
303
|
+
: `[${__('deprecated')}]`;
|
|
304
|
+
const extra = [
|
|
305
|
+
(key in deprecatedOptions) ? deprecatedExtra(deprecatedOptions[key]) : null,
|
|
306
|
+
type,
|
|
307
|
+
(key in demandedOptions) ? `[${__('required')}]` : null,
|
|
308
|
+
options.choices && options.choices[key] ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]` : null,
|
|
309
|
+
defaultString(options.default[key], options.defaultDescription[key])
|
|
310
|
+
].filter(Boolean).join(' ');
|
|
311
|
+
ui.span({ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 }, desc);
|
|
312
|
+
if (extra)
|
|
313
|
+
ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' });
|
|
314
|
+
else
|
|
315
|
+
ui.div();
|
|
316
|
+
});
|
|
317
|
+
ui.div();
|
|
318
|
+
});
|
|
319
|
+
// describe some common use-cases for your application.
|
|
320
|
+
if (examples.length) {
|
|
321
|
+
ui.div(__('Examples:'));
|
|
322
|
+
examples.forEach((example) => {
|
|
323
|
+
example[0] = example[0].replace(/\$0/g, base$0);
|
|
324
|
+
});
|
|
325
|
+
examples.forEach((example) => {
|
|
326
|
+
if (example[1] === '') {
|
|
327
|
+
ui.div({
|
|
328
|
+
text: example[0],
|
|
329
|
+
padding: [0, 2, 0, 2]
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
ui.div({
|
|
334
|
+
text: example[0],
|
|
335
|
+
padding: [0, 2, 0, 2],
|
|
336
|
+
width: maxWidth(examples, theWrap) + 4
|
|
337
|
+
}, {
|
|
338
|
+
text: example[1]
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
ui.div();
|
|
343
|
+
}
|
|
344
|
+
// the usage string.
|
|
345
|
+
if (epilogs.length > 0) {
|
|
346
|
+
const e = epilogs.map(epilog => epilog.replace(/\$0/g, base$0)).join('\n');
|
|
347
|
+
ui.div(`${e}\n`);
|
|
348
|
+
}
|
|
349
|
+
// Remove the trailing white spaces
|
|
350
|
+
return ui.toString().replace(/\s*$/, '');
|
|
351
|
+
};
|
|
352
|
+
// return the maximum width of a string
|
|
353
|
+
// in the left-hand column of a table.
|
|
354
|
+
function maxWidth(table, theWrap, modifier) {
|
|
355
|
+
let width = 0;
|
|
356
|
+
// table might be of the form [leftColumn],
|
|
357
|
+
// or {key: leftColumn}
|
|
358
|
+
if (!Array.isArray(table)) {
|
|
359
|
+
table = Object.values(table).map(v => [v]);
|
|
360
|
+
}
|
|
361
|
+
table.forEach((v) => {
|
|
362
|
+
width = Math.max(stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]), width);
|
|
363
|
+
});
|
|
364
|
+
// if we've enabled 'wrap' we should limit
|
|
365
|
+
// the max-width of the left-column.
|
|
366
|
+
if (theWrap)
|
|
367
|
+
width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10));
|
|
368
|
+
return width;
|
|
369
|
+
}
|
|
370
|
+
// make sure any options set for aliases,
|
|
371
|
+
// are copied to the keys being aliased.
|
|
372
|
+
function normalizeAliases() {
|
|
373
|
+
// handle old demanded API
|
|
374
|
+
const demandedOptions = yargs.getDemandedOptions();
|
|
375
|
+
const options = yargs.getOptions();
|
|
376
|
+
(Object.keys(options.alias) || []).forEach((key) => {
|
|
377
|
+
options.alias[key].forEach((alias) => {
|
|
378
|
+
// copy descriptions.
|
|
379
|
+
if (descriptions[alias])
|
|
380
|
+
self.describe(key, descriptions[alias]);
|
|
381
|
+
// copy demanded.
|
|
382
|
+
if (alias in demandedOptions)
|
|
383
|
+
yargs.demandOption(key, demandedOptions[alias]);
|
|
384
|
+
// type messages.
|
|
385
|
+
if (~options.boolean.indexOf(alias))
|
|
386
|
+
yargs.boolean(key);
|
|
387
|
+
if (~options.count.indexOf(alias))
|
|
388
|
+
yargs.count(key);
|
|
389
|
+
if (~options.string.indexOf(alias))
|
|
390
|
+
yargs.string(key);
|
|
391
|
+
if (~options.normalize.indexOf(alias))
|
|
392
|
+
yargs.normalize(key);
|
|
393
|
+
if (~options.array.indexOf(alias))
|
|
394
|
+
yargs.array(key);
|
|
395
|
+
if (~options.number.indexOf(alias))
|
|
396
|
+
yargs.number(key);
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
// if yargs is executing an async handler, we take a snapshot of the
|
|
401
|
+
// help message to display on failure:
|
|
402
|
+
let cachedHelpMessage;
|
|
403
|
+
self.cacheHelpMessage = function () {
|
|
404
|
+
cachedHelpMessage = this.help();
|
|
405
|
+
};
|
|
406
|
+
// however this snapshot must be cleared afterwards
|
|
407
|
+
// not to be be used by next calls to parse
|
|
408
|
+
self.clearCachedHelpMessage = function () {
|
|
409
|
+
cachedHelpMessage = undefined;
|
|
410
|
+
};
|
|
411
|
+
// given a set of keys, place any keys that are
|
|
412
|
+
// ungrouped under the 'Options:' grouping.
|
|
413
|
+
function addUngroupedKeys(keys, aliases, groups, defaultGroup) {
|
|
414
|
+
let groupedKeys = [];
|
|
415
|
+
let toCheck = null;
|
|
416
|
+
Object.keys(groups).forEach((group) => {
|
|
417
|
+
groupedKeys = groupedKeys.concat(groups[group]);
|
|
418
|
+
});
|
|
419
|
+
keys.forEach((key) => {
|
|
420
|
+
toCheck = [key].concat(aliases[key]);
|
|
421
|
+
if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
|
|
422
|
+
groups[defaultGroup].push(key);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
return groupedKeys;
|
|
426
|
+
}
|
|
427
|
+
function filterHiddenOptions(key) {
|
|
428
|
+
return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt];
|
|
429
|
+
}
|
|
430
|
+
self.showHelp = (level) => {
|
|
431
|
+
const logger = yargs._getLoggerInstance();
|
|
432
|
+
if (!level)
|
|
433
|
+
level = 'error';
|
|
434
|
+
const emit = typeof level === 'function' ? level : logger[level];
|
|
435
|
+
emit(self.help());
|
|
436
|
+
};
|
|
437
|
+
self.functionDescription = (fn) => {
|
|
438
|
+
const description = fn.name ? decamelize(fn.name, '-') : __('generated-value');
|
|
439
|
+
return ['(', description, ')'].join('');
|
|
440
|
+
};
|
|
441
|
+
self.stringifiedValues = function stringifiedValues(values, separator) {
|
|
442
|
+
let string = '';
|
|
443
|
+
const sep = separator || ', ';
|
|
444
|
+
const array = [].concat(values);
|
|
445
|
+
if (!values || !array.length)
|
|
446
|
+
return string;
|
|
447
|
+
array.forEach((value) => {
|
|
448
|
+
if (string.length)
|
|
449
|
+
string += sep;
|
|
450
|
+
string += JSON.stringify(value);
|
|
451
|
+
});
|
|
452
|
+
return string;
|
|
453
|
+
};
|
|
454
|
+
// format the default-value-string displayed in
|
|
455
|
+
// the right-hand column.
|
|
456
|
+
function defaultString(value, defaultDescription) {
|
|
457
|
+
let string = `[${__('default:')} `;
|
|
458
|
+
if (value === undefined && !defaultDescription)
|
|
459
|
+
return null;
|
|
460
|
+
if (defaultDescription) {
|
|
461
|
+
string += defaultDescription;
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
switch (typeof value) {
|
|
465
|
+
case 'string':
|
|
466
|
+
string += `"${value}"`;
|
|
467
|
+
break;
|
|
468
|
+
case 'object':
|
|
469
|
+
string += JSON.stringify(value);
|
|
470
|
+
break;
|
|
471
|
+
default:
|
|
472
|
+
string += value;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
return `${string}]`;
|
|
476
|
+
}
|
|
477
|
+
// guess the width of the console window, max-width 80.
|
|
478
|
+
function windowWidth() {
|
|
479
|
+
const maxWidth = 80;
|
|
480
|
+
// CI is not a TTY
|
|
481
|
+
/* c8 ignore next 2 */
|
|
482
|
+
if (typeof process === 'object' && process.stdout && process.stdout.columns) {
|
|
483
|
+
return Math.min(maxWidth, process.stdout.columns);
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
return maxWidth;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
// logic for displaying application version.
|
|
490
|
+
let version = null;
|
|
491
|
+
self.version = (ver) => {
|
|
492
|
+
version = ver;
|
|
493
|
+
};
|
|
494
|
+
self.showVersion = () => {
|
|
495
|
+
const logger = yargs._getLoggerInstance();
|
|
496
|
+
logger.log(version);
|
|
497
|
+
};
|
|
498
|
+
self.reset = function reset(localLookup) {
|
|
499
|
+
// do not reset wrap here
|
|
500
|
+
// do not reset fails here
|
|
501
|
+
failMessage = null;
|
|
502
|
+
failureOutput = false;
|
|
503
|
+
usages = [];
|
|
504
|
+
usageDisabled = false;
|
|
505
|
+
epilogs = [];
|
|
506
|
+
examples = [];
|
|
507
|
+
commands = [];
|
|
508
|
+
descriptions = obj_filter_1.objFilter(descriptions, k => !localLookup[k]);
|
|
509
|
+
return self;
|
|
510
|
+
};
|
|
511
|
+
const frozens = [];
|
|
512
|
+
self.freeze = function freeze() {
|
|
513
|
+
frozens.push({
|
|
514
|
+
failMessage,
|
|
515
|
+
failureOutput,
|
|
516
|
+
usages,
|
|
517
|
+
usageDisabled,
|
|
518
|
+
epilogs,
|
|
519
|
+
examples,
|
|
520
|
+
commands,
|
|
521
|
+
descriptions
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
self.unfreeze = function unfreeze() {
|
|
525
|
+
const frozen = frozens.pop();
|
|
526
|
+
common_types_1.assertNotStrictEqual(frozen, undefined);
|
|
527
|
+
({
|
|
528
|
+
failMessage,
|
|
529
|
+
failureOutput,
|
|
530
|
+
usages,
|
|
531
|
+
usageDisabled,
|
|
532
|
+
epilogs,
|
|
533
|
+
examples,
|
|
534
|
+
commands,
|
|
535
|
+
descriptions
|
|
536
|
+
} = frozen);
|
|
537
|
+
};
|
|
538
|
+
return self;
|
|
539
|
+
}
|
|
540
|
+
exports.usage = usage;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Dictionary } from './common-types';
|
|
2
|
+
import { UsageInstance } from './usage';
|
|
3
|
+
import { YargsInstance, Arguments } from './yargs';
|
|
4
|
+
import { DetailedArguments } from 'yargs-parser';
|
|
5
|
+
import { Y18N } from 'y18n';
|
|
6
|
+
export declare function validation(yargs: YargsInstance, usage: UsageInstance, y18n: Y18N): ValidationInstance;
|
|
7
|
+
/** Instance of the validation module. */
|
|
8
|
+
export interface ValidationInstance {
|
|
9
|
+
check(f: CustomCheck['func'], global: boolean): void;
|
|
10
|
+
conflicting(argv: Arguments): void;
|
|
11
|
+
conflicts(key: string | Dictionary<string | string[]>, value?: string | string[]): void;
|
|
12
|
+
customChecks(argv: Arguments, aliases: DetailedArguments['aliases']): void;
|
|
13
|
+
freeze(): void;
|
|
14
|
+
getConflicting(): Dictionary<(string | undefined)[]>;
|
|
15
|
+
getImplied(): Dictionary<KeyOrPos[]>;
|
|
16
|
+
implications(argv: Arguments): void;
|
|
17
|
+
implies(key: string | Dictionary<KeyOrPos | KeyOrPos[]>, value?: KeyOrPos | KeyOrPos[]): void;
|
|
18
|
+
isValidAndSomeAliasIsNotNew(key: string, aliases: DetailedArguments['aliases']): boolean;
|
|
19
|
+
limitedChoices(argv: Arguments): void;
|
|
20
|
+
nonOptionCount(argv: Arguments): void;
|
|
21
|
+
positionalCount(required: number, observed: number): void;
|
|
22
|
+
recommendCommands(cmd: string, potentialCommands: string[]): void;
|
|
23
|
+
requiredArguments(argv: Arguments): void;
|
|
24
|
+
reset(localLookup: Dictionary): ValidationInstance;
|
|
25
|
+
unfreeze(): void;
|
|
26
|
+
unknownArguments(argv: Arguments, aliases: DetailedArguments['aliases'], positionalMap: Dictionary, isDefaultCommand: boolean): void;
|
|
27
|
+
unknownCommands(argv: Arguments): boolean;
|
|
28
|
+
}
|
|
29
|
+
interface CustomCheck {
|
|
30
|
+
func: (argv: Arguments, aliases: DetailedArguments['aliases']) => any;
|
|
31
|
+
global: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare type KeyOrPos = string | number;
|
|
34
|
+
export {};
|