@villedemontreal/caporal 3.1.7
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/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/src/__tests__/issue-163.spec.d.ts +2 -0
- package/dist/src/__tests__/issue-163.spec.d.ts.map +1 -0
- package/dist/src/__tests__/issue-163.spec.js +17 -0
- package/dist/src/__tests__/issue-163.spec.js.map +1 -0
- package/dist/src/argument/__tests__/argument.spec.d.ts +2 -0
- package/dist/src/argument/__tests__/argument.spec.d.ts.map +1 -0
- package/dist/src/argument/__tests__/argument.spec.js +85 -0
- package/dist/src/argument/__tests__/argument.spec.js.map +1 -0
- package/dist/src/argument/find.d.ts +8 -0
- package/dist/src/argument/find.d.ts.map +1 -0
- package/dist/src/argument/find.js +11 -0
- package/dist/src/argument/find.js.map +1 -0
- package/dist/src/argument/index.d.ts +13 -0
- package/dist/src/argument/index.d.ts.map +1 -0
- package/dist/src/argument/index.js +27 -0
- package/dist/src/argument/index.js.map +1 -0
- package/dist/src/argument/synopsis.d.ts +19 -0
- package/dist/src/argument/synopsis.d.ts.map +1 -0
- package/dist/src/argument/synopsis.js +39 -0
- package/dist/src/argument/synopsis.js.map +1 -0
- package/dist/src/argument/validate.d.ts +43 -0
- package/dist/src/argument/validate.d.ts.map +1 -0
- package/dist/src/argument/validate.js +127 -0
- package/dist/src/argument/validate.js.map +1 -0
- package/dist/src/autocomplete/__fixtures__/prog-autocomplete.d.ts +3 -0
- package/dist/src/autocomplete/__fixtures__/prog-autocomplete.d.ts.map +1 -0
- package/dist/src/autocomplete/__fixtures__/prog-autocomplete.js +24 -0
- package/dist/src/autocomplete/__fixtures__/prog-autocomplete.js.map +1 -0
- package/dist/src/autocomplete/__tests__/autocomplete.spec.d.ts +2 -0
- package/dist/src/autocomplete/__tests__/autocomplete.spec.d.ts.map +1 -0
- package/dist/src/autocomplete/__tests__/autocomplete.spec.js +119 -0
- package/dist/src/autocomplete/__tests__/autocomplete.spec.js.map +1 -0
- package/dist/src/autocomplete/index.d.ts +20 -0
- package/dist/src/autocomplete/index.d.ts.map +1 -0
- package/dist/src/autocomplete/index.js +172 -0
- package/dist/src/autocomplete/index.js.map +1 -0
- package/dist/src/autocomplete/types.d.ts +26 -0
- package/dist/src/autocomplete/types.d.ts.map +1 -0
- package/dist/src/autocomplete/types.js +3 -0
- package/dist/src/autocomplete/types.js.map +1 -0
- package/dist/src/command/__fixtures__/example-cmd.d.ts +8 -0
- package/dist/src/command/__fixtures__/example-cmd.d.ts.map +1 -0
- package/dist/src/command/__fixtures__/example-cmd.js +10 -0
- package/dist/src/command/__fixtures__/example-cmd.js.map +1 -0
- package/dist/src/command/__tests__/command.spec.d.ts +2 -0
- package/dist/src/command/__tests__/command.spec.d.ts.map +1 -0
- package/dist/src/command/__tests__/command.spec.js +510 -0
- package/dist/src/command/__tests__/command.spec.js.map +1 -0
- package/dist/src/command/__tests__/find.spec.d.ts +2 -0
- package/dist/src/command/__tests__/find.spec.d.ts.map +1 -0
- package/dist/src/command/__tests__/find.spec.js +31 -0
- package/dist/src/command/__tests__/find.spec.js.map +1 -0
- package/dist/src/command/__tests__/import.spec.d.ts +2 -0
- package/dist/src/command/__tests__/import.spec.d.ts.map +1 -0
- package/dist/src/command/__tests__/import.spec.js +17 -0
- package/dist/src/command/__tests__/import.spec.js.map +1 -0
- package/dist/src/command/__tests__/scan.spec.d.ts +2 -0
- package/dist/src/command/__tests__/scan.spec.d.ts.map +1 -0
- package/dist/src/command/__tests__/scan.spec.js +20 -0
- package/dist/src/command/__tests__/scan.spec.js.map +1 -0
- package/dist/src/command/find.d.ts +8 -0
- package/dist/src/command/find.d.ts.map +1 -0
- package/dist/src/command/find.js +47 -0
- package/dist/src/command/find.js.map +1 -0
- package/dist/src/command/import.d.ts +7 -0
- package/dist/src/command/import.d.ts.map +1 -0
- package/dist/src/command/import.js +47 -0
- package/dist/src/command/import.js.map +1 -0
- package/dist/src/command/index.d.ts +211 -0
- package/dist/src/command/index.d.ts.map +1 -0
- package/dist/src/command/index.js +374 -0
- package/dist/src/command/index.js.map +1 -0
- package/dist/src/command/scan.d.ts +4 -0
- package/dist/src/command/scan.d.ts.map +1 -0
- package/dist/src/command/scan.js +31 -0
- package/dist/src/command/scan.js.map +1 -0
- package/dist/src/command/validate-call.d.ts +8 -0
- package/dist/src/command/validate-call.d.ts.map +1 -0
- package/dist/src/command/validate-call.js +13 -0
- package/dist/src/command/validate-call.js.map +1 -0
- package/dist/src/config/index.d.ts +7 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +24 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/error/__tests__/fatal.spec.d.ts +2 -0
- package/dist/src/error/__tests__/fatal.spec.d.ts.map +1 -0
- package/dist/src/error/__tests__/fatal.spec.js +34 -0
- package/dist/src/error/__tests__/fatal.spec.js.map +1 -0
- package/dist/src/error/action.d.ts +9 -0
- package/dist/src/error/action.d.ts.map +1 -0
- package/dist/src/error/action.js +16 -0
- package/dist/src/error/action.js.map +1 -0
- package/dist/src/error/base.d.ts +11 -0
- package/dist/src/error/base.d.ts.map +1 -0
- package/dist/src/error/base.js +18 -0
- package/dist/src/error/base.js.map +1 -0
- package/dist/src/error/fatal.d.ts +10 -0
- package/dist/src/error/fatal.d.ts.map +1 -0
- package/dist/src/error/fatal.js +27 -0
- package/dist/src/error/fatal.js.map +1 -0
- package/dist/src/error/index.d.ts +18 -0
- package/dist/src/error/index.d.ts.map +1 -0
- package/dist/src/error/index.js +34 -0
- package/dist/src/error/index.js.map +1 -0
- package/dist/src/error/invalid-validator.d.ts +10 -0
- package/dist/src/error/invalid-validator.d.ts.map +1 -0
- package/dist/src/error/invalid-validator.js +15 -0
- package/dist/src/error/invalid-validator.js.map +1 -0
- package/dist/src/error/missing-argument.d.ts +11 -0
- package/dist/src/error/missing-argument.d.ts.map +1 -0
- package/dist/src/error/missing-argument.js +20 -0
- package/dist/src/error/missing-argument.js.map +1 -0
- package/dist/src/error/missing-flag.d.ts +11 -0
- package/dist/src/error/missing-flag.d.ts.map +1 -0
- package/dist/src/error/missing-flag.js +20 -0
- package/dist/src/error/missing-flag.js.map +1 -0
- package/dist/src/error/multi-validation.d.ts +10 -0
- package/dist/src/error/multi-validation.d.ts.map +1 -0
- package/dist/src/error/multi-validation.js +26 -0
- package/dist/src/error/multi-validation.js.map +1 -0
- package/dist/src/error/no-action.d.ts +10 -0
- package/dist/src/error/no-action.d.ts.map +1 -0
- package/dist/src/error/no-action.js +22 -0
- package/dist/src/error/no-action.js.map +1 -0
- package/dist/src/error/option-synopsis-syntax.d.ts +9 -0
- package/dist/src/error/option-synopsis-syntax.d.ts.map +1 -0
- package/dist/src/error/option-synopsis-syntax.js +15 -0
- package/dist/src/error/option-synopsis-syntax.js.map +1 -0
- package/dist/src/error/too-many-arguments.d.ts +11 -0
- package/dist/src/error/too-many-arguments.d.ts.map +1 -0
- package/dist/src/error/too-many-arguments.js +25 -0
- package/dist/src/error/too-many-arguments.js.map +1 -0
- package/dist/src/error/unknown-command.d.ts +13 -0
- package/dist/src/error/unknown-command.d.ts.map +1 -0
- package/dist/src/error/unknown-command.js +44 -0
- package/dist/src/error/unknown-command.js.map +1 -0
- package/dist/src/error/unknown-option.d.ts +13 -0
- package/dist/src/error/unknown-option.d.ts.map +1 -0
- package/dist/src/error/unknown-option.js +40 -0
- package/dist/src/error/unknown-option.js.map +1 -0
- package/dist/src/error/validation.d.ts +17 -0
- package/dist/src/error/validation.d.ts.map +1 -0
- package/dist/src/error/validation.js +49 -0
- package/dist/src/error/validation.js.map +1 -0
- package/dist/src/help/__tests__/help.spec.d.ts +2 -0
- package/dist/src/help/__tests__/help.spec.d.ts.map +1 -0
- package/dist/src/help/__tests__/help.spec.js +130 -0
- package/dist/src/help/__tests__/help.spec.js.map +1 -0
- package/dist/src/help/__tests__/utils.spec.d.ts +2 -0
- package/dist/src/help/__tests__/utils.spec.d.ts.map +1 -0
- package/dist/src/help/__tests__/utils.spec.js +16 -0
- package/dist/src/help/__tests__/utils.spec.js.map +1 -0
- package/dist/src/help/index.d.ts +47 -0
- package/dist/src/help/index.d.ts.map +1 -0
- package/dist/src/help/index.js +131 -0
- package/dist/src/help/index.js.map +1 -0
- package/dist/src/help/templates/command.d.ts +7 -0
- package/dist/src/help/templates/command.d.ts.map +1 -0
- package/dist/src/help/templates/command.js +23 -0
- package/dist/src/help/templates/command.js.map +1 -0
- package/dist/src/help/templates/custom.d.ts +7 -0
- package/dist/src/help/templates/custom.d.ts.map +1 -0
- package/dist/src/help/templates/custom.js +24 -0
- package/dist/src/help/templates/custom.js.map +1 -0
- package/dist/src/help/templates/header.d.ts +7 -0
- package/dist/src/help/templates/header.d.ts.map +1 -0
- package/dist/src/help/templates/header.js +16 -0
- package/dist/src/help/templates/header.js.map +1 -0
- package/dist/src/help/templates/index.d.ts +10 -0
- package/dist/src/help/templates/index.d.ts.map +1 -0
- package/dist/src/help/templates/index.js +26 -0
- package/dist/src/help/templates/index.js.map +1 -0
- package/dist/src/help/templates/program.d.ts +7 -0
- package/dist/src/help/templates/program.d.ts.map +1 -0
- package/dist/src/help/templates/program.js +18 -0
- package/dist/src/help/templates/program.js.map +1 -0
- package/dist/src/help/templates/usage.d.ts +7 -0
- package/dist/src/help/templates/usage.d.ts.map +1 -0
- package/dist/src/help/templates/usage.js +19 -0
- package/dist/src/help/templates/usage.js.map +1 -0
- package/dist/src/help/types.d.ts +53 -0
- package/dist/src/help/types.d.ts.map +1 -0
- package/dist/src/help/types.js +3 -0
- package/dist/src/help/types.js.map +1 -0
- package/dist/src/help/utils.d.ts +9 -0
- package/dist/src/help/utils.d.ts.map +1 -0
- package/dist/src/help/utils.js +92 -0
- package/dist/src/help/utils.js.map +1 -0
- package/dist/src/index.d.ts +90 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +111 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/logger/__tests__/logger.spec.d.ts +2 -0
- package/dist/src/logger/__tests__/logger.spec.d.ts.map +1 -0
- package/dist/src/logger/__tests__/logger.spec.js +56 -0
- package/dist/src/logger/__tests__/logger.spec.js.map +1 -0
- package/dist/src/logger/index.d.ts +6 -0
- package/dist/src/logger/index.d.ts.map +1 -0
- package/dist/src/logger/index.js +128 -0
- package/dist/src/logger/index.js.map +1 -0
- package/dist/src/option/__tests__/global.spec.d.ts +2 -0
- package/dist/src/option/__tests__/global.spec.d.ts.map +1 -0
- package/dist/src/option/__tests__/global.spec.js +121 -0
- package/dist/src/option/__tests__/global.spec.js.map +1 -0
- package/dist/src/option/__tests__/option.spec.d.ts +2 -0
- package/dist/src/option/__tests__/option.spec.d.ts.map +1 -0
- package/dist/src/option/__tests__/option.spec.js +111 -0
- package/dist/src/option/__tests__/option.spec.js.map +1 -0
- package/dist/src/option/find.d.ts +14 -0
- package/dist/src/option/find.d.ts.map +1 -0
- package/dist/src/option/find.js +17 -0
- package/dist/src/option/find.js.map +1 -0
- package/dist/src/option/index.d.ts +65 -0
- package/dist/src/option/index.d.ts.map +1 -0
- package/dist/src/option/index.js +230 -0
- package/dist/src/option/index.js.map +1 -0
- package/dist/src/option/mapping.d.ts +7 -0
- package/dist/src/option/mapping.d.ts.map +1 -0
- package/dist/src/option/mapping.js +21 -0
- package/dist/src/option/mapping.js.map +1 -0
- package/dist/src/option/utils.d.ts +35 -0
- package/dist/src/option/utils.d.ts.map +1 -0
- package/dist/src/option/utils.js +139 -0
- package/dist/src/option/utils.js.map +1 -0
- package/dist/src/option/validate.d.ts +15 -0
- package/dist/src/option/validate.d.ts.map +1 -0
- package/dist/src/option/validate.js +63 -0
- package/dist/src/option/validate.js.map +1 -0
- package/dist/src/parser/__tests__/parser.spec.d.ts +2 -0
- package/dist/src/parser/__tests__/parser.spec.d.ts.map +1 -0
- package/dist/src/parser/__tests__/parser.spec.js +343 -0
- package/dist/src/parser/__tests__/parser.spec.js.map +1 -0
- package/dist/src/parser/index.d.ts +17 -0
- package/dist/src/parser/index.d.ts.map +1 -0
- package/dist/src/parser/index.js +299 -0
- package/dist/src/parser/index.js.map +1 -0
- package/dist/src/program/__tests__/program.spec.d.ts +2 -0
- package/dist/src/program/__tests__/program.spec.d.ts.map +1 -0
- package/dist/src/program/__tests__/program.spec.js +261 -0
- package/dist/src/program/__tests__/program.spec.js.map +1 -0
- package/dist/src/program/index.d.ts +349 -0
- package/dist/src/program/index.d.ts.map +1 -0
- package/dist/src/program/index.js +584 -0
- package/dist/src/program/index.js.map +1 -0
- package/dist/src/types.d.ts +396 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +51 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/__tests__/fs.spec.d.ts +2 -0
- package/dist/src/utils/__tests__/fs.spec.d.ts.map +1 -0
- package/dist/src/utils/__tests__/fs.spec.js +14 -0
- package/dist/src/utils/__tests__/fs.spec.js.map +1 -0
- package/dist/src/utils/__tests__/levenshtein.spec.d.ts +2 -0
- package/dist/src/utils/__tests__/levenshtein.spec.d.ts.map +1 -0
- package/dist/src/utils/__tests__/levenshtein.spec.js +18 -0
- package/dist/src/utils/__tests__/levenshtein.spec.js.map +1 -0
- package/dist/src/utils/__tests__/suggest.spec.d.ts +2 -0
- package/dist/src/utils/__tests__/suggest.spec.d.ts.map +1 -0
- package/dist/src/utils/__tests__/suggest.spec.js +31 -0
- package/dist/src/utils/__tests__/suggest.spec.js.map +1 -0
- package/dist/src/utils/colorize.d.ts +2 -0
- package/dist/src/utils/colorize.d.ts.map +1 -0
- package/dist/src/utils/colorize.js +27 -0
- package/dist/src/utils/colorize.js.map +1 -0
- package/dist/src/utils/fs.d.ts +2 -0
- package/dist/src/utils/fs.d.ts.map +1 -0
- package/dist/src/utils/fs.js +19 -0
- package/dist/src/utils/fs.js.map +1 -0
- package/dist/src/utils/levenshtein.d.ts +6 -0
- package/dist/src/utils/levenshtein.d.ts.map +1 -0
- package/dist/src/utils/levenshtein.js +32 -0
- package/dist/src/utils/levenshtein.js.map +1 -0
- package/dist/src/utils/suggest.d.ts +15 -0
- package/dist/src/utils/suggest.d.ts.map +1 -0
- package/dist/src/utils/suggest.js +49 -0
- package/dist/src/utils/suggest.js.map +1 -0
- package/dist/src/utils/version.d.ts +2 -0
- package/dist/src/utils/version.d.ts.map +1 -0
- package/dist/src/utils/version.js +21 -0
- package/dist/src/utils/version.js.map +1 -0
- package/dist/src/utils/web/autocomplete.d.ts +12 -0
- package/dist/src/utils/web/autocomplete.d.ts.map +1 -0
- package/dist/src/utils/web/autocomplete.js +12 -0
- package/dist/src/utils/web/autocomplete.js.map +1 -0
- package/dist/src/utils/web/process.d.ts +15 -0
- package/dist/src/utils/web/process.d.ts.map +1 -0
- package/dist/src/utils/web/process.js +29 -0
- package/dist/src/utils/web/process.js.map +1 -0
- package/dist/src/validator/__tests__/array.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/array.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/array.spec.js +34 -0
- package/dist/src/validator/__tests__/array.spec.js.map +1 -0
- package/dist/src/validator/__tests__/caporal.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/caporal.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/caporal.spec.js +86 -0
- package/dist/src/validator/__tests__/caporal.spec.js.map +1 -0
- package/dist/src/validator/__tests__/function.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/function.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/function.spec.js +42 -0
- package/dist/src/validator/__tests__/function.spec.js.map +1 -0
- package/dist/src/validator/__tests__/regexp.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/regexp.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/regexp.spec.js +34 -0
- package/dist/src/validator/__tests__/regexp.spec.js.map +1 -0
- package/dist/src/validator/__tests__/utils.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/utils.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/utils.spec.js +66 -0
- package/dist/src/validator/__tests__/utils.spec.js.map +1 -0
- package/dist/src/validator/__tests__/validate.spec.d.ts +2 -0
- package/dist/src/validator/__tests__/validate.spec.d.ts.map +1 -0
- package/dist/src/validator/__tests__/validate.spec.js +25 -0
- package/dist/src/validator/__tests__/validate.spec.js.map +1 -0
- package/dist/src/validator/array.d.ts +14 -0
- package/dist/src/validator/array.d.ts.map +1 -0
- package/dist/src/validator/array.js +29 -0
- package/dist/src/validator/array.js.map +1 -0
- package/dist/src/validator/caporal.d.ts +25 -0
- package/dist/src/validator/caporal.d.ts.map +1 -0
- package/dist/src/validator/caporal.js +89 -0
- package/dist/src/validator/caporal.js.map +1 -0
- package/dist/src/validator/function.d.ts +7 -0
- package/dist/src/validator/function.d.ts.map +1 -0
- package/dist/src/validator/function.js +27 -0
- package/dist/src/validator/function.js.map +1 -0
- package/dist/src/validator/regexp.d.ts +14 -0
- package/dist/src/validator/regexp.d.ts.map +1 -0
- package/dist/src/validator/regexp.js +31 -0
- package/dist/src/validator/regexp.js.map +1 -0
- package/dist/src/validator/utils.d.ts +14 -0
- package/dist/src/validator/utils.d.ts.map +1 -0
- package/dist/src/validator/utils.js +81 -0
- package/dist/src/validator/utils.js.map +1 -0
- package/dist/src/validator/validate.d.ts +7 -0
- package/dist/src/validator/validate.d.ts.map +1 -0
- package/dist/src/validator/validate.js +29 -0
- package/dist/src/validator/validate.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +75 -0
- package/src/__tests__/issue-163.spec.ts +18 -0
- package/src/argument/__tests__/argument.spec.ts +84 -0
- package/src/argument/find.ts +11 -0
- package/src/argument/index.ts +35 -0
- package/src/argument/synopsis.ts +41 -0
- package/src/argument/validate.ts +176 -0
- package/src/autocomplete/__fixtures__/prog-autocomplete.ts +24 -0
- package/src/autocomplete/__tests__/autocomplete.spec.ts +129 -0
- package/src/autocomplete/index.ts +225 -0
- package/src/autocomplete/types.ts +29 -0
- package/src/command/__fixtures__/example-cmd.ts +14 -0
- package/src/command/__tests__/command.spec.ts +621 -0
- package/src/command/__tests__/find.spec.ts +32 -0
- package/src/command/__tests__/import.spec.ts +14 -0
- package/src/command/__tests__/scan.spec.ts +16 -0
- package/src/command/find.ts +57 -0
- package/src/command/import.ts +13 -0
- package/src/command/index.ts +458 -0
- package/src/command/scan.ts +30 -0
- package/src/command/validate-call.ts +19 -0
- package/src/config/index.ts +26 -0
- package/src/error/__tests__/fatal.spec.ts +38 -0
- package/src/error/action.ts +13 -0
- package/src/error/base.ts +20 -0
- package/src/error/fatal.ts +25 -0
- package/src/error/index.ts +17 -0
- package/src/error/invalid-validator.ts +12 -0
- package/src/error/missing-argument.ts +16 -0
- package/src/error/missing-flag.ts +16 -0
- package/src/error/multi-validation.ts +22 -0
- package/src/error/no-action.ts +19 -0
- package/src/error/option-synopsis-syntax.ts +12 -0
- package/src/error/too-many-arguments.ts +28 -0
- package/src/error/unknown-command.ts +41 -0
- package/src/error/unknown-option.ts +40 -0
- package/src/error/validation.ts +80 -0
- package/src/help/__tests__/__snapshots__/help.spec.ts.snap +334 -0
- package/src/help/__tests__/help.spec.ts +144 -0
- package/src/help/__tests__/utils.spec.ts +14 -0
- package/src/help/index.ts +107 -0
- package/src/help/templates/command.ts +27 -0
- package/src/help/templates/custom.ts +25 -0
- package/src/help/templates/header.ts +19 -0
- package/src/help/templates/index.ts +9 -0
- package/src/help/templates/program.ts +21 -0
- package/src/help/templates/usage.ts +24 -0
- package/src/help/types.ts +57 -0
- package/src/help/utils.ts +109 -0
- package/src/index.ts +93 -0
- package/src/logger/__tests__/logger.spec.ts +65 -0
- package/src/logger/index.ts +97 -0
- package/src/option/__tests__/global.spec.ts +141 -0
- package/src/option/__tests__/option.spec.ts +115 -0
- package/src/option/find.ts +17 -0
- package/src/option/index.ts +280 -0
- package/src/option/mapping.ts +17 -0
- package/src/option/utils.ts +141 -0
- package/src/option/validate.ts +80 -0
- package/src/parser/__tests__/parser.spec.ts +371 -0
- package/src/parser/index.ts +383 -0
- package/src/program/__tests__/program.spec.ts +316 -0
- package/src/program/index.ts +676 -0
- package/src/types.ts +432 -0
- package/src/utils/__tests__/fs.spec.ts +14 -0
- package/src/utils/__tests__/levenshtein.spec.ts +16 -0
- package/src/utils/__tests__/suggest.spec.ts +30 -0
- package/src/utils/colorize.ts +21 -0
- package/src/utils/fs.ts +13 -0
- package/src/utils/levenshtein.ts +28 -0
- package/src/utils/suggest.ts +52 -0
- package/src/utils/version.ts +14 -0
- package/src/utils/web/autocomplete.ts +19 -0
- package/src/utils/web/process.ts +24 -0
- package/src/validator/__tests__/array.spec.ts +41 -0
- package/src/validator/__tests__/caporal.spec.ts +132 -0
- package/src/validator/__tests__/function.spec.ts +52 -0
- package/src/validator/__tests__/regexp.spec.ts +38 -0
- package/src/validator/__tests__/utils.spec.ts +67 -0
- package/src/validator/__tests__/validate.spec.ts +24 -0
- package/src/validator/array.ts +31 -0
- package/src/validator/caporal.ts +104 -0
- package/src/validator/function.ts +31 -0
- package/src/validator/regexp.ts +34 -0
- package/src/validator/utils.ts +84 -0
- package/src/validator/validate.ts +38 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export * from "./action"
|
|
6
|
+
export * from "./base"
|
|
7
|
+
export * from "./fatal"
|
|
8
|
+
export * from "./invalid-validator"
|
|
9
|
+
export * from "./missing-argument"
|
|
10
|
+
export * from "./missing-flag"
|
|
11
|
+
export * from "./multi-validation"
|
|
12
|
+
export * from "./no-action"
|
|
13
|
+
export * from "./option-synopsis-syntax"
|
|
14
|
+
export * from "./unknown-option"
|
|
15
|
+
export * from "./unknown-command"
|
|
16
|
+
export * from "./validation"
|
|
17
|
+
export * from "./too-many-arguments"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseError } from "./base"
|
|
7
|
+
import { Validator } from "../types"
|
|
8
|
+
export class InvalidValidatorError extends BaseError {
|
|
9
|
+
constructor(validator: Validator) {
|
|
10
|
+
super("Caporal setup error: Invalid flag validator setup.", { validator })
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseError } from "./base"
|
|
7
|
+
import { Command } from "../command"
|
|
8
|
+
import { Argument } from "../types"
|
|
9
|
+
import chalk from "chalk"
|
|
10
|
+
|
|
11
|
+
export class MissingArgumentError extends BaseError {
|
|
12
|
+
constructor(argument: Argument, command: Command) {
|
|
13
|
+
const msg = `Missing required argument ${chalk.bold(argument.name)}.`
|
|
14
|
+
super(msg, { argument, command })
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseError } from "./base"
|
|
7
|
+
import { Command } from "../command"
|
|
8
|
+
import { Option } from "../types"
|
|
9
|
+
import chalk from "chalk"
|
|
10
|
+
|
|
11
|
+
export class MissingFlagError extends BaseError {
|
|
12
|
+
constructor(flag: Option, command: Command) {
|
|
13
|
+
const msg = `Missing required flag ${chalk.bold(flag.allNotations.join(" | "))}.`
|
|
14
|
+
super(msg, { flag, command })
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseError, CommonError } from "./base"
|
|
7
|
+
import chalk from "chalk"
|
|
8
|
+
import { colorize } from "../utils/colorize"
|
|
9
|
+
import type { Command } from "../command"
|
|
10
|
+
|
|
11
|
+
export class ValidationSummaryError extends BaseError {
|
|
12
|
+
constructor(cmd: Command, errors: CommonError[]) {
|
|
13
|
+
const plural = errors.length > 1 ? "s" : ""
|
|
14
|
+
const msg =
|
|
15
|
+
`The following error${plural} occured:\n` +
|
|
16
|
+
errors.map((e) => "- " + e.message.replace(/\n/g, "\n ")).join("\n") +
|
|
17
|
+
"\n\n" +
|
|
18
|
+
chalk.dim("Synopsis: ") +
|
|
19
|
+
colorize(cmd.synopsis)
|
|
20
|
+
super(msg, { errors })
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseError } from "./base"
|
|
7
|
+
import { Command } from "../command"
|
|
8
|
+
|
|
9
|
+
export class NoActionError extends BaseError {
|
|
10
|
+
constructor(cmd?: Command) {
|
|
11
|
+
let message
|
|
12
|
+
if (cmd && !cmd.isProgramCommand()) {
|
|
13
|
+
message = `Caporal Error: You haven't defined any action for command '${cmd.name}'.\nUse .action() to do so.`
|
|
14
|
+
} else {
|
|
15
|
+
message = `Caporal Error: You haven't defined any action for program.\nUse .action() to do so.`
|
|
16
|
+
}
|
|
17
|
+
super(message, { cmd })
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseError } from "./base"
|
|
7
|
+
|
|
8
|
+
export class OptionSynopsisSyntaxError extends BaseError {
|
|
9
|
+
constructor(synopsis: string) {
|
|
10
|
+
super(`Syntax error in option synopsis: ${synopsis}`, { synopsis })
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseError } from "./base"
|
|
7
|
+
import { ArgumentsRange } from "../types"
|
|
8
|
+
import { Command } from "../command"
|
|
9
|
+
import { format } from "util"
|
|
10
|
+
import c from "chalk"
|
|
11
|
+
|
|
12
|
+
export class TooManyArgumentsError extends BaseError {
|
|
13
|
+
constructor(cmd: Command, range: ArgumentsRange, argsCount: number) {
|
|
14
|
+
const expArgsStr =
|
|
15
|
+
range.min === range.max
|
|
16
|
+
? `exactly ${range.min}.`
|
|
17
|
+
: `between ${range.min} and ${range.max}.`
|
|
18
|
+
|
|
19
|
+
const cmdName = cmd.isProgramCommand() ? "" : `for command ${c.bold(cmd.name)}`
|
|
20
|
+
const message = format(
|
|
21
|
+
`Too many argument(s) %s. Got %s, expected %s`,
|
|
22
|
+
cmdName,
|
|
23
|
+
c.bold.redBright(argsCount),
|
|
24
|
+
c.bold.greenBright(expArgsStr),
|
|
25
|
+
)
|
|
26
|
+
super(message, { command: cmd })
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseError } from "./base"
|
|
7
|
+
import { getSuggestions, boldDiffString } from "../utils/suggest"
|
|
8
|
+
import chalk from "chalk"
|
|
9
|
+
import type { Program } from "../program"
|
|
10
|
+
import flatMap from "lodash/flatMap"
|
|
11
|
+
import filter from "lodash/filter"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @todo Rewrite
|
|
15
|
+
*/
|
|
16
|
+
export class UnknownOrUnspecifiedCommandError extends BaseError {
|
|
17
|
+
constructor(program: Program, command?: string) {
|
|
18
|
+
const possibilities = filter(
|
|
19
|
+
flatMap(program.getCommands(), (c) => [c.name, ...c.getAliases()]),
|
|
20
|
+
)
|
|
21
|
+
let msg = ""
|
|
22
|
+
if (command) {
|
|
23
|
+
msg = `Unknown command ${chalk.bold(command)}.`
|
|
24
|
+
const suggestions = getSuggestions(command, possibilities)
|
|
25
|
+
if (suggestions.length) {
|
|
26
|
+
msg +=
|
|
27
|
+
" Did you mean " +
|
|
28
|
+
suggestions.map((s) => boldDiffString(command, s)).join(" or maybe ") +
|
|
29
|
+
" ?"
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
msg =
|
|
33
|
+
"Unspecified command. Available commands are:\n" +
|
|
34
|
+
possibilities.map((p) => chalk.whiteBright(p)).join(", ") +
|
|
35
|
+
"." +
|
|
36
|
+
`\n\nFor more help, type ${chalk.whiteBright(program.getBin() + " --help")}`
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
super(msg, { command })
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseError } from "./base"
|
|
7
|
+
import type { Option } from "../types"
|
|
8
|
+
import { getDashedOpt } from "../option/utils"
|
|
9
|
+
import { getGlobalOptions } from "../option"
|
|
10
|
+
import { getSuggestions, boldDiffString } from "../utils/suggest"
|
|
11
|
+
import c from "chalk"
|
|
12
|
+
import type { Command } from "../command"
|
|
13
|
+
import filter from "lodash/fp/filter"
|
|
14
|
+
import map from "lodash/fp/map"
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @todo Rewrite
|
|
18
|
+
*/
|
|
19
|
+
export class UnknownOptionError extends BaseError {
|
|
20
|
+
constructor(flag: string, command: Command) {
|
|
21
|
+
const longFlags = filter((f: Option) => f.name.length > 1),
|
|
22
|
+
getFlagNames = map((f: Option) => f.name),
|
|
23
|
+
possibilities = getFlagNames([
|
|
24
|
+
...longFlags(command.options),
|
|
25
|
+
...getGlobalOptions().keys(),
|
|
26
|
+
]),
|
|
27
|
+
suggestions = getSuggestions(flag, possibilities)
|
|
28
|
+
|
|
29
|
+
let msg = `Unknown option ${c.bold.redBright(getDashedOpt(flag))}. `
|
|
30
|
+
if (suggestions.length) {
|
|
31
|
+
msg +=
|
|
32
|
+
"Did you mean " +
|
|
33
|
+
suggestions
|
|
34
|
+
.map((s) => boldDiffString(getDashedOpt(flag), getDashedOpt(s)))
|
|
35
|
+
.join(" or maybe ") +
|
|
36
|
+
" ?"
|
|
37
|
+
}
|
|
38
|
+
super(msg, { flag, command })
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { format } from "util"
|
|
7
|
+
import c from "chalk"
|
|
8
|
+
import { BaseError } from "./base"
|
|
9
|
+
import { Validator, ParserTypes, Argument, Option, CaporalValidator } from "../types"
|
|
10
|
+
import { isCaporalValidator } from "../validator/utils"
|
|
11
|
+
|
|
12
|
+
interface ValidationErrorParameters {
|
|
13
|
+
value: ParserTypes | ParserTypes[]
|
|
14
|
+
error?: Error | string
|
|
15
|
+
validator: Validator
|
|
16
|
+
context: Argument | Option
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isOptionObject(obj: Option | Argument): obj is Option {
|
|
20
|
+
return "allNotations" in obj
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class ValidationError extends BaseError {
|
|
24
|
+
constructor({ value, error, validator, context }: ValidationErrorParameters) {
|
|
25
|
+
let message = error instanceof Error ? error.message : error
|
|
26
|
+
const varName = isOptionObject(context) ? "option" : "argument"
|
|
27
|
+
const name = isOptionObject(context)
|
|
28
|
+
? context.allNotations.join("|")
|
|
29
|
+
: context.synopsis
|
|
30
|
+
|
|
31
|
+
if (isCaporalValidator(validator)) {
|
|
32
|
+
switch (validator) {
|
|
33
|
+
case CaporalValidator.NUMBER:
|
|
34
|
+
message = format(
|
|
35
|
+
'Invalid value for %s %s.\nExpected a %s but got "%s".',
|
|
36
|
+
varName,
|
|
37
|
+
c.redBright(name),
|
|
38
|
+
c.underline("number"),
|
|
39
|
+
c.redBright(value),
|
|
40
|
+
)
|
|
41
|
+
break
|
|
42
|
+
case CaporalValidator.BOOLEAN:
|
|
43
|
+
message = format(
|
|
44
|
+
'Invalid value for %s %s.\nExpected a %s (true, false, 0, 1), but got "%s".',
|
|
45
|
+
varName,
|
|
46
|
+
c.redBright(name),
|
|
47
|
+
c.underline("boolean"),
|
|
48
|
+
c.redBright(value),
|
|
49
|
+
)
|
|
50
|
+
break
|
|
51
|
+
case CaporalValidator.STRING:
|
|
52
|
+
message = format(
|
|
53
|
+
'Invalid value for %s %s.\nExpected a %s, but got "%s".',
|
|
54
|
+
varName,
|
|
55
|
+
c.redBright(name),
|
|
56
|
+
c.underline("string"),
|
|
57
|
+
c.redBright(value),
|
|
58
|
+
)
|
|
59
|
+
break
|
|
60
|
+
}
|
|
61
|
+
} else if (Array.isArray(validator)) {
|
|
62
|
+
message = format(
|
|
63
|
+
'Invalid value for %s %s.\nExpected one of %s, but got "%s".',
|
|
64
|
+
varName,
|
|
65
|
+
c.redBright(name),
|
|
66
|
+
"'" + validator.join("', '") + "'",
|
|
67
|
+
c.redBright(value),
|
|
68
|
+
)
|
|
69
|
+
} else if (validator instanceof RegExp) {
|
|
70
|
+
message = format(
|
|
71
|
+
'Invalid value for %s %s.\nExpected a value matching %s, but got "%s".',
|
|
72
|
+
varName,
|
|
73
|
+
c.redBright(name),
|
|
74
|
+
c.whiteBright(validator.toString()),
|
|
75
|
+
c.redBright(value),
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
super(message + "")
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`help > getHelp() > should display customized program help 1`] = `
|
|
4
|
+
"
|
|
5
|
+
test-prog — Description test
|
|
6
|
+
|
|
7
|
+
USAGE
|
|
8
|
+
|
|
9
|
+
▸ test-prog <command> [ARGUMENTS...] [OPTIONS...]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
My custom help
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
COMMANDS — Type 'test-prog help <command>' to get some help about a command
|
|
16
|
+
|
|
17
|
+
test-command Test command
|
|
18
|
+
|
|
19
|
+
GLOBAL OPTIONS
|
|
20
|
+
|
|
21
|
+
-h, --help Display global help or command-related help.
|
|
22
|
+
-V, --version Display version.
|
|
23
|
+
--no-color Disable use of colors in output.
|
|
24
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
25
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
26
|
+
--silent Silent mode: does not output anything, giving no
|
|
27
|
+
indication of success or failure other than the exit
|
|
28
|
+
code.
|
|
29
|
+
"
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
exports[`help > getHelp() > should display customized program help on multiple lines 1`] = `
|
|
33
|
+
"
|
|
34
|
+
test-prog — Description test
|
|
35
|
+
|
|
36
|
+
USAGE
|
|
37
|
+
|
|
38
|
+
▸ test-prog <command> [ARGUMENTS...] [OPTIONS...]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
COMMANDS — Type 'test-prog help <command>' to get some help about a command
|
|
42
|
+
|
|
43
|
+
test-command Test command
|
|
44
|
+
|
|
45
|
+
GLOBAL OPTIONS
|
|
46
|
+
|
|
47
|
+
-h, --help Display global help or command-related help.
|
|
48
|
+
-V, --version Display version.
|
|
49
|
+
--no-color Disable use of colors in output.
|
|
50
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
51
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
52
|
+
--silent Silent mode: does not output anything, giving no
|
|
53
|
+
indication of success or failure other than the exit
|
|
54
|
+
code.
|
|
55
|
+
"
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
exports[`help > getHelp() > should display help for a basic program 1`] = `
|
|
59
|
+
"
|
|
60
|
+
test-prog
|
|
61
|
+
|
|
62
|
+
USAGE
|
|
63
|
+
|
|
64
|
+
▸ test-prog
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
GLOBAL OPTIONS
|
|
70
|
+
|
|
71
|
+
-h, --help Display global help or command-related help.
|
|
72
|
+
-V, --version Display version.
|
|
73
|
+
--no-color Disable use of colors in output.
|
|
74
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
75
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
76
|
+
--silent Silent mode: does not output anything, giving no
|
|
77
|
+
indication of success or failure other than the exit
|
|
78
|
+
code.
|
|
79
|
+
"
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
exports[`help > getHelp() > should display help for a program having at least one command (with args & options) 1`] = `
|
|
83
|
+
"
|
|
84
|
+
test-prog
|
|
85
|
+
|
|
86
|
+
USAGE
|
|
87
|
+
|
|
88
|
+
▸ test-prog <command> [ARGUMENTS...] [OPTIONS...]
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
COMMANDS — Type 'test-prog help <command>' to get some help about a command
|
|
92
|
+
|
|
93
|
+
test-command Test command
|
|
94
|
+
|
|
95
|
+
GLOBAL OPTIONS
|
|
96
|
+
|
|
97
|
+
-h, --help Display global help or command-related help.
|
|
98
|
+
-V, --version Display version.
|
|
99
|
+
--no-color Disable use of colors in output.
|
|
100
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
101
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
102
|
+
--silent Silent mode: does not output anything, giving no
|
|
103
|
+
indication of success or failure other than the exit
|
|
104
|
+
code.
|
|
105
|
+
"
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
exports[`help > getHelp() > should display help for a program having at least one command (with args only) 1`] = `
|
|
109
|
+
"
|
|
110
|
+
test-prog
|
|
111
|
+
|
|
112
|
+
USAGE
|
|
113
|
+
|
|
114
|
+
▸ test-prog <command> [ARGUMENTS...] [OPTIONS...]
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
COMMANDS — Type 'test-prog help <command>' to get some help about a command
|
|
118
|
+
|
|
119
|
+
test-command Test command
|
|
120
|
+
|
|
121
|
+
GLOBAL OPTIONS
|
|
122
|
+
|
|
123
|
+
-h, --help Display global help or command-related help.
|
|
124
|
+
-V, --version Display version.
|
|
125
|
+
--no-color Disable use of colors in output.
|
|
126
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
127
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
128
|
+
--silent Silent mode: does not output anything, giving no
|
|
129
|
+
indication of success or failure other than the exit
|
|
130
|
+
code.
|
|
131
|
+
"
|
|
132
|
+
`;
|
|
133
|
+
|
|
134
|
+
exports[`help > getHelp() > should display help for a program having at least one command (with options only) 1`] = `
|
|
135
|
+
"
|
|
136
|
+
test-prog
|
|
137
|
+
|
|
138
|
+
USAGE
|
|
139
|
+
|
|
140
|
+
▸ test-prog <command> [ARGUMENTS...] [OPTIONS...]
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
COMMANDS — Type 'test-prog help <command>' to get some help about a command
|
|
144
|
+
|
|
145
|
+
test-command Test command
|
|
146
|
+
|
|
147
|
+
GLOBAL OPTIONS
|
|
148
|
+
|
|
149
|
+
-h, --help Display global help or command-related help.
|
|
150
|
+
-V, --version Display version.
|
|
151
|
+
--no-color Disable use of colors in output.
|
|
152
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
153
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
154
|
+
--silent Silent mode: does not output anything, giving no
|
|
155
|
+
indication of success or failure other than the exit
|
|
156
|
+
code.
|
|
157
|
+
"
|
|
158
|
+
`;
|
|
159
|
+
|
|
160
|
+
exports[`help > getHelp() > should display help for a program-command 1`] = `
|
|
161
|
+
"
|
|
162
|
+
test-prog
|
|
163
|
+
|
|
164
|
+
USAGE
|
|
165
|
+
|
|
166
|
+
▸ test-prog <foo> [other] [OPTIONS...]
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
ARGUMENTS
|
|
170
|
+
|
|
171
|
+
<foo> Mandarory foo arg
|
|
172
|
+
[other] Other args
|
|
173
|
+
|
|
174
|
+
OPTIONS
|
|
175
|
+
|
|
176
|
+
-f, --file <file> Output file
|
|
177
|
+
|
|
178
|
+
GLOBAL OPTIONS
|
|
179
|
+
|
|
180
|
+
-h, --help Display global help or command-related help.
|
|
181
|
+
-V, --version Display version.
|
|
182
|
+
--no-color Disable use of colors in output.
|
|
183
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
184
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
185
|
+
--silent Silent mode: does not output anything, giving no
|
|
186
|
+
indication of success or failure other than the exit
|
|
187
|
+
code.
|
|
188
|
+
"
|
|
189
|
+
`;
|
|
190
|
+
|
|
191
|
+
exports[`help > getHelp() > should display program description 1`] = `
|
|
192
|
+
"
|
|
193
|
+
test-prog — Description test
|
|
194
|
+
|
|
195
|
+
USAGE
|
|
196
|
+
|
|
197
|
+
▸ test-prog <command> [ARGUMENTS...] [OPTIONS...]
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
COMMANDS — Type 'test-prog help <command>' to get some help about a command
|
|
201
|
+
|
|
202
|
+
test-command Test command
|
|
203
|
+
|
|
204
|
+
GLOBAL OPTIONS
|
|
205
|
+
|
|
206
|
+
-h, --help Display global help or command-related help.
|
|
207
|
+
-V, --version Display version.
|
|
208
|
+
--no-color Disable use of colors in output.
|
|
209
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
210
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
211
|
+
--silent Silent mode: does not output anything, giving no
|
|
212
|
+
indication of success or failure other than the exit
|
|
213
|
+
code.
|
|
214
|
+
"
|
|
215
|
+
`;
|
|
216
|
+
|
|
217
|
+
exports[`help > getHelp() > should handle required options 1`] = `
|
|
218
|
+
"
|
|
219
|
+
test-prog
|
|
220
|
+
|
|
221
|
+
USAGE — test-command
|
|
222
|
+
|
|
223
|
+
▸ test-prog test-command <OPTIONS...>
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
OPTIONS
|
|
228
|
+
|
|
229
|
+
-f, --file <file> Output file
|
|
230
|
+
required
|
|
231
|
+
|
|
232
|
+
GLOBAL OPTIONS
|
|
233
|
+
|
|
234
|
+
-h, --help Display global help or command-related help.
|
|
235
|
+
-V, --version Display version.
|
|
236
|
+
--no-color Disable use of colors in output.
|
|
237
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
238
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
239
|
+
--silent Silent mode: does not output anything, giving no
|
|
240
|
+
indication of success or failure other than the exit
|
|
241
|
+
code.
|
|
242
|
+
"
|
|
243
|
+
`;
|
|
244
|
+
|
|
245
|
+
exports[`help > getHelp() > should handle type hints 1`] = `
|
|
246
|
+
"
|
|
247
|
+
test-prog
|
|
248
|
+
|
|
249
|
+
USAGE — test-command
|
|
250
|
+
|
|
251
|
+
▸ test-prog test-command <foo> <OPTIONS...>
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
ARGUMENTS
|
|
255
|
+
|
|
256
|
+
<foo> Desc
|
|
257
|
+
number
|
|
258
|
+
|
|
259
|
+
OPTIONS
|
|
260
|
+
|
|
261
|
+
-f, --file <file> Output file
|
|
262
|
+
required number
|
|
263
|
+
|
|
264
|
+
GLOBAL OPTIONS
|
|
265
|
+
|
|
266
|
+
-h, --help Display global help or command-related help.
|
|
267
|
+
-V, --version Display version.
|
|
268
|
+
--no-color Disable use of colors in output.
|
|
269
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
270
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
271
|
+
--silent Silent mode: does not output anything, giving no
|
|
272
|
+
indication of success or failure other than the exit
|
|
273
|
+
code.
|
|
274
|
+
"
|
|
275
|
+
`;
|
|
276
|
+
|
|
277
|
+
exports[`help > getHelp() > should work with a program without a specified name 1`] = `
|
|
278
|
+
"
|
|
279
|
+
test-prog
|
|
280
|
+
|
|
281
|
+
USAGE
|
|
282
|
+
|
|
283
|
+
▸ test-prog <command> [ARGUMENTS...] [OPTIONS...]
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
COMMANDS — Type 'test-prog help <command>' to get some help about a command
|
|
287
|
+
|
|
288
|
+
test-command Test command
|
|
289
|
+
|
|
290
|
+
GLOBAL OPTIONS
|
|
291
|
+
|
|
292
|
+
-h, --help Display global help or command-related help.
|
|
293
|
+
-V, --version Display version.
|
|
294
|
+
--no-color Disable use of colors in output.
|
|
295
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
296
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
297
|
+
--silent Silent mode: does not output anything, giving no
|
|
298
|
+
indication of success or failure other than the exit
|
|
299
|
+
code.
|
|
300
|
+
"
|
|
301
|
+
`;
|
|
302
|
+
|
|
303
|
+
exports[`help > getHelp() > should work with a program without a version 1`] = `
|
|
304
|
+
"
|
|
305
|
+
test-prog
|
|
306
|
+
|
|
307
|
+
USAGE
|
|
308
|
+
|
|
309
|
+
▸ test-prog <command> [ARGUMENTS...] [OPTIONS...]
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
COMMANDS — Type 'test-prog help <command>' to get some help about a command
|
|
313
|
+
|
|
314
|
+
test-command Test command
|
|
315
|
+
|
|
316
|
+
GLOBAL OPTIONS
|
|
317
|
+
|
|
318
|
+
-h, --help Display global help or command-related help.
|
|
319
|
+
-V, --version Display version.
|
|
320
|
+
--no-color Disable use of colors in output.
|
|
321
|
+
-v, --verbose Verbose mode: will also output debug messages.
|
|
322
|
+
--quiet Quiet mode - only displays warn and error messages.
|
|
323
|
+
--silent Silent mode: does not output anything, giving no
|
|
324
|
+
indication of success or failure other than the exit
|
|
325
|
+
code.
|
|
326
|
+
"
|
|
327
|
+
`;
|
|
328
|
+
|
|
329
|
+
exports[`help > tpl() > should compile template with given context 1`] = `
|
|
330
|
+
"
|
|
331
|
+
test-prog
|
|
332
|
+
|
|
333
|
+
"
|
|
334
|
+
`;
|