@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,584 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Program = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
* @module caporal/program
|
|
10
|
+
*/
|
|
11
|
+
const events_1 = require("events");
|
|
12
|
+
const fs_1 = __importDefault(require("fs"));
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
14
|
+
const kebabCase_1 = __importDefault(require("lodash/kebabCase"));
|
|
15
|
+
const mapKeys_1 = __importDefault(require("lodash/mapKeys"));
|
|
16
|
+
const command_1 = require("../command");
|
|
17
|
+
const find_1 = require("../command/find");
|
|
18
|
+
const scan_1 = require("../command/scan");
|
|
19
|
+
const config_1 = require("../config");
|
|
20
|
+
const error_1 = require("../error");
|
|
21
|
+
const help_1 = require("../help");
|
|
22
|
+
const logger_1 = require("../logger");
|
|
23
|
+
const option_1 = require("../option");
|
|
24
|
+
const parser_1 = require("../parser");
|
|
25
|
+
const types_1 = require("../types");
|
|
26
|
+
const version_1 = require("../utils/version");
|
|
27
|
+
const LOG_LEVEL_ENV_VAR = "CAPORAL_LOG_LEVEL";
|
|
28
|
+
// const SUPPORTED_SHELL = ["bash", "zsh", "fish"]
|
|
29
|
+
/**
|
|
30
|
+
* Program class
|
|
31
|
+
*
|
|
32
|
+
* @noInheritDoc
|
|
33
|
+
*/
|
|
34
|
+
class Program extends events_1.EventEmitter {
|
|
35
|
+
/**
|
|
36
|
+
* Program constructor.
|
|
37
|
+
* - Detects the "bin" name from process argv
|
|
38
|
+
* - Detects the version from package.json
|
|
39
|
+
* - Set up the help command
|
|
40
|
+
* @ignore
|
|
41
|
+
*/
|
|
42
|
+
constructor() {
|
|
43
|
+
super();
|
|
44
|
+
this.commands = [];
|
|
45
|
+
this._programmaticMode = false;
|
|
46
|
+
/**
|
|
47
|
+
* Number validator. Check that the value looks like a numeric one
|
|
48
|
+
* and cast the provided value to a javascript `Number`.
|
|
49
|
+
*/
|
|
50
|
+
this.NUMBER = types_1.CaporalValidator.NUMBER;
|
|
51
|
+
/**
|
|
52
|
+
* String validator. Mainly used to make sure the value is a string,
|
|
53
|
+
* and prevent Caporal auto-casting of numerical values and boolean
|
|
54
|
+
* strings like `true` or `false`.
|
|
55
|
+
*/
|
|
56
|
+
this.STRING = types_1.CaporalValidator.STRING;
|
|
57
|
+
/**
|
|
58
|
+
* Array validator. Convert any provided value to an array. If a string is provided,
|
|
59
|
+
* this validator will try to split it by commas.
|
|
60
|
+
*/
|
|
61
|
+
this.ARRAY = types_1.CaporalValidator.ARRAY;
|
|
62
|
+
/**
|
|
63
|
+
* Boolean validator. Check that the value looks like a boolean.
|
|
64
|
+
* It accepts values like `true`, `false`, `yes`, `no`, `0`, and `1`
|
|
65
|
+
* and will auto-cast those values to `true` or `false`.
|
|
66
|
+
*/
|
|
67
|
+
this.BOOLEAN = types_1.CaporalValidator.BOOLEAN;
|
|
68
|
+
this._bin = path_1.default.basename(process.argv[1]);
|
|
69
|
+
this._version = (0, version_1.detectVersion)();
|
|
70
|
+
this._config = (0, config_1.createConfigurator)({
|
|
71
|
+
strictArgsCount: true,
|
|
72
|
+
strictOptions: true,
|
|
73
|
+
autoCast: true,
|
|
74
|
+
logLevelEnvVar: LOG_LEVEL_ENV_VAR,
|
|
75
|
+
});
|
|
76
|
+
this.setupHelpCommand();
|
|
77
|
+
this.setupErrorHandlers();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
setupErrorHandlers() {
|
|
83
|
+
process.once("unhandledRejection", (err) => {
|
|
84
|
+
if (this._programmaticMode) {
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.emit("error", err);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
this.on("error", error_1.fatalError);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The program-command is the command attached directly to the program,
|
|
95
|
+
* meaning there is no command-keyword used to trigger it.
|
|
96
|
+
* Mainly used for programs executing only one possible action.
|
|
97
|
+
*
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
get progCommand() {
|
|
101
|
+
if (this._progCommand === undefined) {
|
|
102
|
+
this._progCommand = (0, command_1.createCommand)(this, command_1.PROG_CMD, "");
|
|
103
|
+
}
|
|
104
|
+
return this._progCommand;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Setup the help command
|
|
108
|
+
*/
|
|
109
|
+
setupHelpCommand() {
|
|
110
|
+
return this.command(command_1.HELP_CMD, "Get help about a specific command")
|
|
111
|
+
.argument("[command]", "Command name to get help for. If the command does not exist, global help will be displayed.")
|
|
112
|
+
.action(async (actionParams) => {
|
|
113
|
+
const { args } = actionParams;
|
|
114
|
+
const command = args.command
|
|
115
|
+
? await (0, find_1.findCommand)(this, [args.command])
|
|
116
|
+
: undefined;
|
|
117
|
+
// eslint-disable-next-line no-console
|
|
118
|
+
(0, option_1.showHelp)({ ...actionParams, command });
|
|
119
|
+
return -1;
|
|
120
|
+
})
|
|
121
|
+
.hide();
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Customize program help. Can be called multiple times to add more paragraphs and/or sections.
|
|
125
|
+
*
|
|
126
|
+
* @param text Help contents
|
|
127
|
+
* @param options Display options
|
|
128
|
+
*/
|
|
129
|
+
help(text, options = {}) {
|
|
130
|
+
(0, help_1.customizeHelp)(this, text, options);
|
|
131
|
+
return this;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Toggle strict mode.
|
|
135
|
+
* Shortcut to calling: `.configure({ strictArgsCount: strict, strictOptions: strict })`.
|
|
136
|
+
* By default, the program is strict, so if you want to disable strict checking,
|
|
137
|
+
* just call `.strict(false)`. This setting can be overridden at the command level.
|
|
138
|
+
*
|
|
139
|
+
* @param strict boolean enabled flag
|
|
140
|
+
*/
|
|
141
|
+
strict(strict = true) {
|
|
142
|
+
return this.configure({
|
|
143
|
+
strictArgsCount: strict,
|
|
144
|
+
strictOptions: strict,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Configure some behavioral properties.
|
|
149
|
+
*
|
|
150
|
+
* @param props properties to set/update
|
|
151
|
+
*/
|
|
152
|
+
configure(props) {
|
|
153
|
+
this._config.set(props);
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get a configuration property value. {@link ProgramConfig Possible keys}.
|
|
158
|
+
*
|
|
159
|
+
* @param key Property
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
getConfigProperty(key) {
|
|
163
|
+
return this._config.get(key);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Return a reformatted synopsis string
|
|
167
|
+
*
|
|
168
|
+
* @internal
|
|
169
|
+
*/
|
|
170
|
+
async getSynopsis() {
|
|
171
|
+
return (this.getBin() +
|
|
172
|
+
" " +
|
|
173
|
+
((await this.hasCommands()) ? "<command> " : "") +
|
|
174
|
+
"[ARGUMENTS...] [OPTIONS...]").trim();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Return the discovery path, if set
|
|
178
|
+
*
|
|
179
|
+
* @internal
|
|
180
|
+
*/
|
|
181
|
+
get discoveryPath() {
|
|
182
|
+
return this._discoveryPath;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Return the program version
|
|
186
|
+
*
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
getVersion() {
|
|
190
|
+
return this._version;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Set the version fo your program.
|
|
194
|
+
* You won't likely use this method as Caporal tries to guess it from your package.json
|
|
195
|
+
*/
|
|
196
|
+
version(ver) {
|
|
197
|
+
this._version = ver;
|
|
198
|
+
return this;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Set the program name. If not set, the filename minus the extension will be used.
|
|
202
|
+
*/
|
|
203
|
+
name(name) {
|
|
204
|
+
this._name = name;
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Return the program name.
|
|
209
|
+
*
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
212
|
+
getName() {
|
|
213
|
+
return this._name;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Return the program description.
|
|
217
|
+
*
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
getDescription() {
|
|
221
|
+
return this._description;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Set the program description displayed in help.
|
|
225
|
+
*/
|
|
226
|
+
description(desc) {
|
|
227
|
+
this._description = desc;
|
|
228
|
+
return this;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get the bin name (the name of your executable).
|
|
232
|
+
*
|
|
233
|
+
* @internal
|
|
234
|
+
*/
|
|
235
|
+
getBin() {
|
|
236
|
+
return this._bin;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Sets the executable name. By default, it's auto-detected from the filename of your program.
|
|
240
|
+
*
|
|
241
|
+
* @param name Executable name
|
|
242
|
+
* @example
|
|
243
|
+
* ```ts
|
|
244
|
+
* program.bin('myprog')
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
bin(name) {
|
|
248
|
+
this._bin = name;
|
|
249
|
+
return this;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Set a custom logger for your program.
|
|
253
|
+
* Your logger should implement the {@link Logger} interface.
|
|
254
|
+
*/
|
|
255
|
+
logger(logger) {
|
|
256
|
+
(0, logger_1.setLogger)(logger);
|
|
257
|
+
return this;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Get the configured logger instance
|
|
261
|
+
*/
|
|
262
|
+
getLogger() {
|
|
263
|
+
return (0, logger_1.getLogger)();
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Disable a global option. Will warn if the global option
|
|
267
|
+
* does not exist of has already been disabled.
|
|
268
|
+
*
|
|
269
|
+
* @param name Name, short, or long notation of the option to disable.
|
|
270
|
+
*/
|
|
271
|
+
disableGlobalOption(name) {
|
|
272
|
+
const disabled = (0, option_1.disableGlobalOption)(name);
|
|
273
|
+
if (!disabled) {
|
|
274
|
+
logger_1.logger.warn("Cannot disable global option %s. Either the global option does not exist or has already been disabled.");
|
|
275
|
+
}
|
|
276
|
+
return this;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Returns the list of all commands registered
|
|
280
|
+
* - By default, Caporal creates one: the "help" command
|
|
281
|
+
* - When calling argument() or action() on the program instance,
|
|
282
|
+
* Caporal also create what is called the "program command", which
|
|
283
|
+
* is a command directly attach to the program, usually used
|
|
284
|
+
* in mono-command programs.
|
|
285
|
+
* @internal
|
|
286
|
+
*/
|
|
287
|
+
getCommands() {
|
|
288
|
+
return this.commands;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Add a command to the program.
|
|
292
|
+
*
|
|
293
|
+
* @param name Command name
|
|
294
|
+
* @param description Command description
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* program.command('order', 'Order some food')
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
command(name, description, config = {}) {
|
|
301
|
+
const cmd = (0, command_1.createCommand)(this, name, description, config);
|
|
302
|
+
this.commands.push(cmd);
|
|
303
|
+
return cmd;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Check if the program has user-defined commands.
|
|
307
|
+
*
|
|
308
|
+
* @internal
|
|
309
|
+
* @private
|
|
310
|
+
*/
|
|
311
|
+
async hasCommands() {
|
|
312
|
+
return (await this.getAllCommands()).length > 1;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* @internal
|
|
316
|
+
*/
|
|
317
|
+
async getAllCommands() {
|
|
318
|
+
const discoveredCommands = await this.scanCommands();
|
|
319
|
+
return [...this.commands, ...discoveredCommands];
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Return the log level override, if any is provided using
|
|
323
|
+
* the right environment variable.
|
|
324
|
+
*
|
|
325
|
+
* @internal
|
|
326
|
+
* @private
|
|
327
|
+
*/
|
|
328
|
+
getLogLevelOverride() {
|
|
329
|
+
return process.env[this.getConfigProperty("logLevelEnvVar")];
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Enable or disable auto casting of arguments & options at the program level.
|
|
333
|
+
*
|
|
334
|
+
* @param enabled
|
|
335
|
+
*/
|
|
336
|
+
cast(enabled) {
|
|
337
|
+
return this.configure({ autoCast: enabled });
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Sets a *unique* action for the *entire* program.
|
|
341
|
+
*
|
|
342
|
+
* @param {Function} action - Action to run
|
|
343
|
+
*/
|
|
344
|
+
action(action) {
|
|
345
|
+
this.progCommand.action(action);
|
|
346
|
+
return this;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Add an argument to the *unique* command of the program.
|
|
350
|
+
*/
|
|
351
|
+
argument(synopsis, description, options = {}) {
|
|
352
|
+
return this.progCommand.argument(synopsis, description, options);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Add an option to the *unique* command of the program,
|
|
356
|
+
* or add a global option to the program when `options.global`
|
|
357
|
+
* is set to `true`.
|
|
358
|
+
*
|
|
359
|
+
* @param synopsis Option synopsis like '-f, --force', or '-f, --file \<file\>', or '--with-openssl [path]'
|
|
360
|
+
* @param description Option description
|
|
361
|
+
* @param options Additional parameters
|
|
362
|
+
*/
|
|
363
|
+
option(synopsis, description, options = {}) {
|
|
364
|
+
if (options.global) {
|
|
365
|
+
const opt = (0, option_1.createOption)(synopsis, description, options);
|
|
366
|
+
(0, option_1.addGlobalOption)(opt, options.action);
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
this.progCommand.option(synopsis, description, options);
|
|
370
|
+
}
|
|
371
|
+
return this;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Discover commands from a specified path.
|
|
375
|
+
*
|
|
376
|
+
* Commands must be organized into files (one command per file) in a file tree like:
|
|
377
|
+
*
|
|
378
|
+
* ```sh
|
|
379
|
+
* └── commands
|
|
380
|
+
* ├── config
|
|
381
|
+
* │ ├── set.ts
|
|
382
|
+
* │ └── unset.ts
|
|
383
|
+
* ├── create
|
|
384
|
+
* │ ├── job.ts
|
|
385
|
+
* │ └── service.ts
|
|
386
|
+
* ├── create.ts
|
|
387
|
+
* ├── describe.ts
|
|
388
|
+
* └── get.ts
|
|
389
|
+
* ```
|
|
390
|
+
*
|
|
391
|
+
* The code above shows a short example of `kubectl` commands and subcommands.
|
|
392
|
+
* In this case, Caporal will generate the following commands:
|
|
393
|
+
*
|
|
394
|
+
* - kubectl get [args...] [options...]
|
|
395
|
+
* - kubectl config set [args...] [options...]
|
|
396
|
+
* - kubectl config unset [args...] [options...]
|
|
397
|
+
* - kubectl create [args...] [options...]
|
|
398
|
+
* - kubectl create job [args...] [options...]
|
|
399
|
+
* - kubectl create service [args...] [options...]
|
|
400
|
+
* - kubectl describe [args...] [options...]
|
|
401
|
+
* - kubectl get [args...] [options...]
|
|
402
|
+
*
|
|
403
|
+
* Notice how the `config` command has a mandatory subcommand associated,
|
|
404
|
+
* hence cannot be called without a subcommand, contrary to the `create` command.
|
|
405
|
+
* This is why there is no `config.ts` in the tree.
|
|
406
|
+
*
|
|
407
|
+
* @param path
|
|
408
|
+
*/
|
|
409
|
+
discover(dirPath) {
|
|
410
|
+
let stat;
|
|
411
|
+
try {
|
|
412
|
+
stat = fs_1.default.statSync(dirPath);
|
|
413
|
+
// eslint-disable-next-line no-empty
|
|
414
|
+
}
|
|
415
|
+
catch (e) { }
|
|
416
|
+
if (!stat || !stat.isDirectory()) {
|
|
417
|
+
throw new Error("Caporal setup error: parameter `dirPath` of discover() should be a directory");
|
|
418
|
+
}
|
|
419
|
+
this._discoveryPath = dirPath;
|
|
420
|
+
return this;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Do a full scan of the discovery path to get all existing commands
|
|
424
|
+
* This should only be used to generate the full list of command,
|
|
425
|
+
* as for help rendering
|
|
426
|
+
*
|
|
427
|
+
* @private
|
|
428
|
+
*/
|
|
429
|
+
async scanCommands() {
|
|
430
|
+
if (this._discoveryPath === undefined) {
|
|
431
|
+
return [];
|
|
432
|
+
}
|
|
433
|
+
if (this._discoveredCommands) {
|
|
434
|
+
return this._discoveredCommands;
|
|
435
|
+
}
|
|
436
|
+
this._discoveredCommands = await (0, scan_1.scanCommands)(this, this._discoveryPath);
|
|
437
|
+
return this._discoveredCommands;
|
|
438
|
+
}
|
|
439
|
+
/* istanbul ignore next */
|
|
440
|
+
/**
|
|
441
|
+
* Reset all commands
|
|
442
|
+
*
|
|
443
|
+
* @internal
|
|
444
|
+
*/
|
|
445
|
+
reset() {
|
|
446
|
+
this.commands = [];
|
|
447
|
+
this._progCommand = undefined;
|
|
448
|
+
this.setupHelpCommand();
|
|
449
|
+
return this;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Run the program by parsing command line arguments.
|
|
453
|
+
* Caporal will automatically detect command line arguments from `process.argv` values,
|
|
454
|
+
* but it can be overridden by providing the `argv` parameter. It returns a Promise
|
|
455
|
+
* of the value returned by the *Action* triggered.
|
|
456
|
+
*
|
|
457
|
+
* ::: warning Be careful
|
|
458
|
+
* This method returns a `Promise`. You'll usually ignore the returned promise and call run() like this:
|
|
459
|
+
*
|
|
460
|
+
* ```ts
|
|
461
|
+
* [...]
|
|
462
|
+
* program.action(...)
|
|
463
|
+
* program.run()
|
|
464
|
+
* ```
|
|
465
|
+
*
|
|
466
|
+
* If you do add some `.catch()` handler to it, Caporal won't display any potential errors
|
|
467
|
+
* that the promise could reject, and will let you the responsibility to do it.
|
|
468
|
+
* :::
|
|
469
|
+
*
|
|
470
|
+
* @param argv Command line arguments to parse, default to `process.argv.slice(2)`.
|
|
471
|
+
*/
|
|
472
|
+
async run(argv) {
|
|
473
|
+
if (!argv) {
|
|
474
|
+
// used on web playground
|
|
475
|
+
if (process.env.CAPORAL_CMD_LINE) {
|
|
476
|
+
argv = process.env.CAPORAL_CMD_LINE.split(" ").slice(1);
|
|
477
|
+
// defaut value for common usage
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
argv = process.argv.slice(2);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
/*
|
|
484
|
+
Search for the command from args, then, if a default command exists,
|
|
485
|
+
take it, otherwise take the command attached to the program,
|
|
486
|
+
and lastly the help command/
|
|
487
|
+
*/
|
|
488
|
+
const cmd = await this.findCommand(argv);
|
|
489
|
+
// parse command line args
|
|
490
|
+
const result = (0, parser_1.parseArgv)(cmd?.getParserConfig(), argv);
|
|
491
|
+
/*
|
|
492
|
+
Run command with parsed args.
|
|
493
|
+
We are forced to catch a potential error to prevent the rejected
|
|
494
|
+
promise to propagate un in the stack.
|
|
495
|
+
*/
|
|
496
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
497
|
+
return this._run(result, cmd); /*
|
|
498
|
+
.catch((e) => e) */
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Try to find the executed command from argv
|
|
502
|
+
* If command cannot be found from argv, return the default command if any,
|
|
503
|
+
* then the program-command if any, or finally `undefined`.
|
|
504
|
+
* If argv is empty, and there is no defaultCommand or progCommand
|
|
505
|
+
* use the help command
|
|
506
|
+
*
|
|
507
|
+
* @param argv
|
|
508
|
+
*/
|
|
509
|
+
async findCommand(argv) {
|
|
510
|
+
const cmd = await (0, find_1.findCommand)(this, argv);
|
|
511
|
+
if (cmd) {
|
|
512
|
+
return cmd;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* If we've been asked for help (and only help) and there is no progCommand,
|
|
516
|
+
* so we should return undefined in order for the help command to display
|
|
517
|
+
* the global help.
|
|
518
|
+
* Fixes this particular use case: Fixes this particular use case:
|
|
519
|
+
* https://github.com/mattallty/Caporal.js/issues/196
|
|
520
|
+
*/
|
|
521
|
+
if (argv.every((arg) => arg === "--help") && !this._progCommand) {
|
|
522
|
+
return undefined;
|
|
523
|
+
}
|
|
524
|
+
return this.defaultCommand || this._progCommand;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Run a command, providing parsed data
|
|
528
|
+
*
|
|
529
|
+
* @param result
|
|
530
|
+
* @param cmd
|
|
531
|
+
* @internal
|
|
532
|
+
*/
|
|
533
|
+
async _run(result, cmd) {
|
|
534
|
+
// Override logger level via ENV if needed
|
|
535
|
+
const loggerLevel = this.getLogLevelOverride();
|
|
536
|
+
if (loggerLevel && Object.keys(logger_1.logger.levels).includes(loggerLevel)) {
|
|
537
|
+
logger_1.logger.level = loggerLevel;
|
|
538
|
+
}
|
|
539
|
+
// try to run the command
|
|
540
|
+
// try {
|
|
541
|
+
if (!cmd) {
|
|
542
|
+
// we may not have any associated command, but some global options may have been passed
|
|
543
|
+
// process them, if any
|
|
544
|
+
// Process any global options
|
|
545
|
+
const processedResult = { ...result, errors: [], args: {} };
|
|
546
|
+
const shouldStop = await (0, option_1.processGlobalOptions)(processedResult, this);
|
|
547
|
+
if (shouldStop) {
|
|
548
|
+
this.emit("run");
|
|
549
|
+
return -1;
|
|
550
|
+
}
|
|
551
|
+
// todo: use case: "git unknown-command some args" will display "unknown command 'git'"
|
|
552
|
+
// but should display "unknown command 'git unknown-command'"
|
|
553
|
+
throw new error_1.UnknownOrUnspecifiedCommandError(this, result.rawArgv[0]);
|
|
554
|
+
}
|
|
555
|
+
const ret = await cmd.run(result);
|
|
556
|
+
this.emit("run", ret);
|
|
557
|
+
return ret;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Programmatic usage. Execute input command with given arguments & options
|
|
561
|
+
*
|
|
562
|
+
* Not ideal regarding type casting etc.
|
|
563
|
+
*
|
|
564
|
+
* @param args argv array
|
|
565
|
+
* @param options options object
|
|
566
|
+
* @param ddash double dash array
|
|
567
|
+
* @public
|
|
568
|
+
*/
|
|
569
|
+
async exec(args, options = {}, ddash = []) {
|
|
570
|
+
this._programmaticMode = true;
|
|
571
|
+
const cmd = await this.findCommand(args);
|
|
572
|
+
options = (0, mapKeys_1.default)(options, (v, key) => (0, kebabCase_1.default)(key));
|
|
573
|
+
return this._run({
|
|
574
|
+
args,
|
|
575
|
+
options,
|
|
576
|
+
line: args.join(" "),
|
|
577
|
+
rawOptions: options,
|
|
578
|
+
rawArgv: args,
|
|
579
|
+
ddash,
|
|
580
|
+
}, cmd);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
exports.Program = Program;
|
|
584
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 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