zod-args-parser 2.0.0-beta.0 → 2.0.0-beta.2
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 +1 -0
- package/README.md +230 -289
- package/lib/esm/autocomplete-scripts/bash-autocomplete-script.js +74 -2
- package/lib/esm/autocomplete-scripts/bash-autocomplete-script.js.map +7 -1
- package/lib/esm/autocomplete-scripts/powershell-autocomplete-script.js +90 -2
- package/lib/esm/autocomplete-scripts/powershell-autocomplete-script.js.map +7 -1
- package/lib/esm/autocomplete-scripts/zsh-autocomplete-script.js +39 -13
- package/lib/esm/autocomplete-scripts/zsh-autocomplete-script.js.map +7 -1
- package/lib/esm/cli-error/cli-error.js +38 -0
- package/lib/esm/cli-error/cli-error.js.map +7 -0
- package/lib/esm/cli-error/error-cause.js +12 -0
- package/lib/esm/cli-error/error-cause.js.map +7 -0
- package/lib/esm/cli-error/error-code/definition-error-code.js +23 -0
- package/lib/esm/cli-error/error-code/definition-error-code.js.map +7 -0
- package/lib/esm/cli-error/error-code/internal-error-code.js +10 -0
- package/lib/esm/cli-error/error-code/internal-error-code.js.map +7 -0
- package/lib/esm/cli-error/error-code/parse-error-code.js +18 -0
- package/lib/esm/cli-error/error-code/parse-error-code.js.map +7 -0
- package/lib/esm/cli-error/error-code/validation-error-code.js +17 -0
- package/lib/esm/cli-error/error-code/validation-error-code.js.map +7 -0
- package/lib/esm/cli-error/error-message/definition-error-message.js +70 -0
- package/lib/esm/cli-error/error-message/definition-error-message.js.map +7 -0
- package/lib/esm/cli-error/error-message/internal-error-message.js +16 -0
- package/lib/esm/cli-error/error-message/internal-error-message.js.map +7 -0
- package/lib/esm/cli-error/error-message/parse-error-message.js +40 -0
- package/lib/esm/cli-error/error-message/parse-error-message.js.map +7 -0
- package/lib/esm/cli-error/error-message/validation-error-message.js +60 -0
- package/lib/esm/cli-error/error-message/validation-error-message.js.map +7 -0
- package/lib/esm/coerce/coerce-methods.js +197 -2
- package/lib/esm/coerce/coerce-methods.js.map +7 -1
- package/lib/esm/coerce/string-to-array.js +17 -2
- package/lib/esm/coerce/string-to-array.js.map +7 -1
- package/lib/esm/coerce/string-to-primitive.js +73 -2
- package/lib/esm/coerce/string-to-primitive.js.map +7 -1
- package/lib/esm/coerce/string-to-set.js +17 -2
- package/lib/esm/coerce/string-to-set.js.map +7 -1
- package/lib/esm/definitions/define-arguments.js +10 -2
- package/lib/esm/definitions/define-arguments.js.map +7 -1
- package/lib/esm/definitions/define-cli.js +89 -2
- package/lib/esm/definitions/define-cli.js.map +7 -1
- package/lib/esm/definitions/define-options.js +10 -2
- package/lib/esm/definitions/define-options.js.map +7 -1
- package/lib/esm/definitions/define-subcommand.js +56 -2
- package/lib/esm/definitions/define-subcommand.js.map +7 -1
- package/lib/esm/definitions/validate-cli-definition.js +360 -2
- package/lib/esm/definitions/validate-cli-definition.js.map +7 -1
- package/lib/esm/help-message/format-arguments.js +48 -2
- package/lib/esm/help-message/format-arguments.js.map +7 -1
- package/lib/esm/help-message/format-options.js +50 -2
- package/lib/esm/help-message/format-options.js.map +7 -1
- package/lib/esm/help-message/format-subcommands.js +37 -2
- package/lib/esm/help-message/format-subcommands.js.map +7 -1
- package/lib/esm/help-message/generate-for-cli.js +71 -2
- package/lib/esm/help-message/generate-for-cli.js.map +7 -1
- package/lib/esm/help-message/generate-for-subcommand.js +23 -2
- package/lib/esm/help-message/generate-for-subcommand.js.map +7 -1
- package/lib/esm/help-message/print-help.js +14 -2
- package/lib/esm/help-message/print-help.js.map +7 -1
- package/lib/esm/help-message/set-defaults.js +29 -2
- package/lib/esm/help-message/set-defaults.js.map +7 -1
- package/lib/esm/help-message/styles.js +154 -2
- package/lib/esm/help-message/styles.js.map +7 -1
- package/lib/esm/help-message/terminal-markdown.js +121 -2
- package/lib/esm/help-message/terminal-markdown.js.map +7 -1
- package/lib/esm/index.js +52 -2
- package/lib/esm/index.js.map +7 -1
- package/lib/esm/markdown/generate-markdown.js +153 -2
- package/lib/esm/markdown/generate-markdown.js.map +7 -1
- package/lib/esm/metadata/arguments-metadata.js +26 -2
- package/lib/esm/metadata/arguments-metadata.js.map +7 -1
- package/lib/esm/metadata/cli-metadata.js +24 -2
- package/lib/esm/metadata/cli-metadata.js.map +7 -1
- package/lib/esm/metadata/options-metadata.js +35 -2
- package/lib/esm/metadata/options-metadata.js.map +7 -1
- package/lib/esm/metadata/subcommands-metadata.js +32 -2
- package/lib/esm/metadata/subcommands-metadata.js.map +7 -1
- package/lib/esm/parse/context/cli-context-builder.js +283 -2
- package/lib/esm/parse/context/cli-context-builder.js.map +7 -1
- package/lib/esm/parse/context/object-context-builder.js +62 -2
- package/lib/esm/parse/context/object-context-builder.js.map +7 -1
- package/lib/esm/parse/parser-utilities.js +108 -2
- package/lib/esm/parse/parser-utilities.js.map +7 -1
- package/lib/esm/parse/safe-parse.js +57 -2
- package/lib/esm/parse/safe-parse.js.map +7 -1
- package/lib/esm/parse/validation/validate-context.js +17 -2
- package/lib/esm/parse/validation/validate-context.js.map +7 -1
- package/lib/esm/parse/validation/validators/arguments.js +67 -2
- package/lib/esm/parse/validation/validators/arguments.js.map +7 -1
- package/lib/esm/parse/validation/validators/conflict.js +38 -2
- package/lib/esm/parse/validation/validators/conflict.js.map +7 -1
- package/lib/esm/parse/validation/validators/exclusive.js +39 -2
- package/lib/esm/parse/validation/validators/exclusive.js.map +7 -1
- package/lib/esm/parse/validation/validators/explicitly-passed.js +18 -2
- package/lib/esm/parse/validation/validators/explicitly-passed.js.map +7 -1
- package/lib/esm/parse/validation/validators/options.js +67 -2
- package/lib/esm/parse/validation/validators/options.js.map +7 -1
- package/lib/esm/parse/validation/validators/requires.js +43 -2
- package/lib/esm/parse/validation/validators/requires.js.map +7 -1
- package/lib/esm/utilities/parse-argv.js +61 -0
- package/lib/esm/utilities/parse-argv.js.map +7 -0
- package/lib/esm/utilities/schema-utilities.js +57 -0
- package/lib/esm/utilities/schema-utilities.js.map +7 -0
- package/lib/esm/utilities/utilities.js +122 -0
- package/lib/esm/utilities/utilities.js.map +7 -0
- package/lib/iife/index.js +1 -1
- package/lib/iife/index.js.map +1 -1
- package/lib/mjs/autocomplete-scripts/bash-autocomplete-script.mjs +74 -2
- package/lib/mjs/autocomplete-scripts/bash-autocomplete-script.mjs.map +7 -1
- package/lib/mjs/autocomplete-scripts/powershell-autocomplete-script.mjs +90 -2
- package/lib/mjs/autocomplete-scripts/powershell-autocomplete-script.mjs.map +7 -1
- package/lib/mjs/autocomplete-scripts/zsh-autocomplete-script.mjs +39 -13
- package/lib/mjs/autocomplete-scripts/zsh-autocomplete-script.mjs.map +7 -1
- package/lib/mjs/cli-error/cli-error.mjs +38 -0
- package/lib/mjs/cli-error/cli-error.mjs.map +7 -0
- package/lib/mjs/cli-error/error-cause.mjs +12 -0
- package/lib/mjs/cli-error/error-cause.mjs.map +7 -0
- package/lib/mjs/cli-error/error-code/definition-error-code.mjs +23 -0
- package/lib/mjs/cli-error/error-code/definition-error-code.mjs.map +7 -0
- package/lib/mjs/cli-error/error-code/internal-error-code.mjs +10 -0
- package/lib/mjs/cli-error/error-code/internal-error-code.mjs.map +7 -0
- package/lib/mjs/cli-error/error-code/parse-error-code.mjs +18 -0
- package/lib/mjs/cli-error/error-code/parse-error-code.mjs.map +7 -0
- package/lib/mjs/cli-error/error-code/validation-error-code.mjs +17 -0
- package/lib/mjs/cli-error/error-code/validation-error-code.mjs.map +7 -0
- package/lib/mjs/cli-error/error-message/definition-error-message.mjs +70 -0
- package/lib/mjs/cli-error/error-message/definition-error-message.mjs.map +7 -0
- package/lib/mjs/cli-error/error-message/internal-error-message.mjs +16 -0
- package/lib/mjs/cli-error/error-message/internal-error-message.mjs.map +7 -0
- package/lib/mjs/cli-error/error-message/parse-error-message.mjs +40 -0
- package/lib/mjs/cli-error/error-message/parse-error-message.mjs.map +7 -0
- package/lib/mjs/cli-error/error-message/validation-error-message.mjs +60 -0
- package/lib/mjs/cli-error/error-message/validation-error-message.mjs.map +7 -0
- package/lib/mjs/coerce/coerce-methods.mjs +197 -2
- package/lib/mjs/coerce/coerce-methods.mjs.map +7 -1
- package/lib/mjs/coerce/string-to-array.mjs +17 -2
- package/lib/mjs/coerce/string-to-array.mjs.map +7 -1
- package/lib/mjs/coerce/string-to-primitive.mjs +73 -2
- package/lib/mjs/coerce/string-to-primitive.mjs.map +7 -1
- package/lib/mjs/coerce/string-to-set.mjs +17 -2
- package/lib/mjs/coerce/string-to-set.mjs.map +7 -1
- package/lib/mjs/definitions/define-arguments.mjs +10 -2
- package/lib/mjs/definitions/define-arguments.mjs.map +7 -1
- package/lib/mjs/definitions/define-cli.mjs +89 -2
- package/lib/mjs/definitions/define-cli.mjs.map +7 -1
- package/lib/mjs/definitions/define-options.mjs +10 -2
- package/lib/mjs/definitions/define-options.mjs.map +7 -1
- package/lib/mjs/definitions/define-subcommand.mjs +56 -2
- package/lib/mjs/definitions/define-subcommand.mjs.map +7 -1
- package/lib/mjs/definitions/validate-cli-definition.mjs +360 -2
- package/lib/mjs/definitions/validate-cli-definition.mjs.map +7 -1
- package/lib/mjs/help-message/format-arguments.mjs +48 -2
- package/lib/mjs/help-message/format-arguments.mjs.map +7 -1
- package/lib/mjs/help-message/format-options.mjs +50 -2
- package/lib/mjs/help-message/format-options.mjs.map +7 -1
- package/lib/mjs/help-message/format-subcommands.mjs +37 -2
- package/lib/mjs/help-message/format-subcommands.mjs.map +7 -1
- package/lib/mjs/help-message/generate-for-cli.mjs +71 -2
- package/lib/mjs/help-message/generate-for-cli.mjs.map +7 -1
- package/lib/mjs/help-message/generate-for-subcommand.mjs +23 -2
- package/lib/mjs/help-message/generate-for-subcommand.mjs.map +7 -1
- package/lib/mjs/help-message/print-help.mjs +14 -2
- package/lib/mjs/help-message/print-help.mjs.map +7 -1
- package/lib/mjs/help-message/set-defaults.mjs +29 -2
- package/lib/mjs/help-message/set-defaults.mjs.map +7 -1
- package/lib/mjs/help-message/styles.mjs +154 -2
- package/lib/mjs/help-message/styles.mjs.map +7 -1
- package/lib/mjs/help-message/terminal-markdown.mjs +121 -2
- package/lib/mjs/help-message/terminal-markdown.mjs.map +7 -1
- package/lib/mjs/index.mjs +52 -2
- package/lib/mjs/index.mjs.map +7 -1
- package/lib/mjs/markdown/generate-markdown.mjs +153 -2
- package/lib/mjs/markdown/generate-markdown.mjs.map +7 -1
- package/lib/mjs/metadata/arguments-metadata.mjs +26 -2
- package/lib/mjs/metadata/arguments-metadata.mjs.map +7 -1
- package/lib/mjs/metadata/cli-metadata.mjs +24 -2
- package/lib/mjs/metadata/cli-metadata.mjs.map +7 -1
- package/lib/mjs/metadata/options-metadata.mjs +35 -2
- package/lib/mjs/metadata/options-metadata.mjs.map +7 -1
- package/lib/mjs/metadata/subcommands-metadata.mjs +32 -2
- package/lib/mjs/metadata/subcommands-metadata.mjs.map +7 -1
- package/lib/mjs/parse/context/cli-context-builder.mjs +283 -2
- package/lib/mjs/parse/context/cli-context-builder.mjs.map +7 -1
- package/lib/mjs/parse/context/object-context-builder.mjs +62 -2
- package/lib/mjs/parse/context/object-context-builder.mjs.map +7 -1
- package/lib/mjs/parse/parser-utilities.mjs +108 -2
- package/lib/mjs/parse/parser-utilities.mjs.map +7 -1
- package/lib/mjs/parse/safe-parse.mjs +57 -2
- package/lib/mjs/parse/safe-parse.mjs.map +7 -1
- package/lib/mjs/parse/validation/validate-context.mjs +17 -2
- package/lib/mjs/parse/validation/validate-context.mjs.map +7 -1
- package/lib/mjs/parse/validation/validators/arguments.mjs +67 -2
- package/lib/mjs/parse/validation/validators/arguments.mjs.map +7 -1
- package/lib/mjs/parse/validation/validators/conflict.mjs +38 -2
- package/lib/mjs/parse/validation/validators/conflict.mjs.map +7 -1
- package/lib/mjs/parse/validation/validators/exclusive.mjs +39 -2
- package/lib/mjs/parse/validation/validators/exclusive.mjs.map +7 -1
- package/lib/mjs/parse/validation/validators/explicitly-passed.mjs +18 -2
- package/lib/mjs/parse/validation/validators/explicitly-passed.mjs.map +7 -1
- package/lib/mjs/parse/validation/validators/options.mjs +67 -2
- package/lib/mjs/parse/validation/validators/options.mjs.map +7 -1
- package/lib/mjs/parse/validation/validators/requires.mjs +43 -2
- package/lib/mjs/parse/validation/validators/requires.mjs.map +7 -1
- package/lib/mjs/utilities/parse-argv.mjs +61 -0
- package/lib/mjs/utilities/parse-argv.mjs.map +7 -0
- package/lib/mjs/utilities/schema-utilities.mjs +57 -0
- package/lib/mjs/utilities/schema-utilities.mjs.map +7 -0
- package/lib/mjs/utilities/utilities.mjs +122 -0
- package/lib/mjs/utilities/utilities.mjs.map +7 -0
- package/lib/{typescript → types}/autocomplete-scripts/bash-autocomplete-script.d.ts.map +1 -1
- package/lib/types/autocomplete-scripts/powershell-autocomplete-script.d.ts +15 -0
- package/lib/{typescript → types}/autocomplete-scripts/powershell-autocomplete-script.d.ts.map +1 -1
- package/lib/types/autocomplete-scripts/zsh-autocomplete-script.d.ts +4 -0
- package/lib/{typescript → types}/autocomplete-scripts/zsh-autocomplete-script.d.ts.map +1 -1
- package/lib/types/cli-error/cli-error.d.ts +152 -0
- package/lib/types/cli-error/cli-error.d.ts.map +1 -0
- package/lib/types/cli-error/error-cause.d.ts +5 -0
- package/lib/types/cli-error/error-cause.d.ts.map +1 -0
- package/lib/types/cli-error/error-code/definition-error-code.d.ts +5 -0
- package/lib/types/cli-error/error-code/definition-error-code.d.ts.map +1 -0
- package/lib/types/cli-error/error-code/internal-error-code.d.ts +5 -0
- package/lib/types/cli-error/error-code/internal-error-code.d.ts.map +1 -0
- package/lib/types/cli-error/error-code/parse-error-code.d.ts +5 -0
- package/lib/types/cli-error/error-code/parse-error-code.d.ts.map +1 -0
- package/lib/types/cli-error/error-code/validation-error-code.d.ts +5 -0
- package/lib/types/cli-error/error-code/validation-error-code.d.ts.map +1 -0
- package/lib/types/cli-error/error-message/definition-error-message.d.ts +3 -0
- package/lib/types/cli-error/error-message/definition-error-message.d.ts.map +1 -0
- package/lib/types/cli-error/error-message/internal-error-message.d.ts +3 -0
- package/lib/types/cli-error/error-message/internal-error-message.d.ts.map +1 -0
- package/lib/types/cli-error/error-message/parse-error-message.d.ts +3 -0
- package/lib/types/cli-error/error-message/parse-error-message.d.ts.map +1 -0
- package/lib/types/cli-error/error-message/validation-error-message.d.ts +3 -0
- package/lib/types/cli-error/error-message/validation-error-message.d.ts.map +1 -0
- package/lib/types/coerce/coerce-methods.d.ts +122 -0
- package/lib/types/coerce/coerce-methods.d.ts.map +1 -0
- package/lib/{typescript → types}/coerce/string-to-array.d.ts +2 -2
- package/lib/types/coerce/string-to-array.d.ts.map +1 -0
- package/lib/types/coerce/string-to-primitive.d.ts +21 -0
- package/lib/types/coerce/string-to-primitive.d.ts.map +1 -0
- package/lib/{typescript → types}/coerce/string-to-set.d.ts +2 -2
- package/lib/{typescript → types}/coerce/string-to-set.d.ts.map +1 -1
- package/lib/{typescript → types}/definitions/define-cli.d.ts +2 -6
- package/lib/types/definitions/define-cli.d.ts.map +1 -0
- package/lib/{typescript → types}/definitions/define-subcommand.d.ts +2 -4
- package/lib/types/definitions/define-subcommand.d.ts.map +1 -0
- package/lib/{typescript → types}/definitions/validate-cli-definition.d.ts +1 -1
- package/lib/types/definitions/validate-cli-definition.d.ts.map +1 -0
- package/lib/{typescript → types}/help-message/terminal-markdown.d.ts.map +1 -1
- package/lib/{typescript → types}/index.d.ts +7 -0
- package/lib/{typescript → types}/index.d.ts.map +1 -1
- package/lib/{typescript → types}/metadata/arguments-metadata.d.ts.map +1 -1
- package/lib/{typescript → types}/metadata/options-metadata.d.ts.map +1 -1
- package/lib/{typescript → types}/parse/context/cli-context-builder.d.ts +1 -1
- package/lib/{typescript → types}/parse/context/cli-context-builder.d.ts.map +1 -1
- package/lib/{typescript → types}/parse/context/object-context-builder.d.ts +1 -1
- package/lib/types/parse/context/object-context-builder.d.ts.map +1 -0
- package/lib/{typescript → types}/parse/parser-utilities.d.ts +9 -0
- package/lib/{typescript → types}/parse/parser-utilities.d.ts.map +1 -1
- package/lib/{typescript → types}/parse/safe-parse.d.ts.map +1 -1
- package/lib/{typescript → types}/parse/validation/validate-context.d.ts +1 -1
- package/lib/{typescript → types}/parse/validation/validate-context.d.ts.map +1 -1
- package/lib/{typescript → types}/parse/validation/validators/arguments.d.ts +1 -1
- package/lib/{typescript → types}/parse/validation/validators/arguments.d.ts.map +1 -1
- package/lib/{typescript → types}/parse/validation/validators/conflict.d.ts +3 -3
- package/lib/{typescript → types}/parse/validation/validators/conflict.d.ts.map +1 -1
- package/lib/{typescript → types}/parse/validation/validators/exclusive.d.ts +3 -3
- package/lib/{typescript → types}/parse/validation/validators/exclusive.d.ts.map +1 -1
- package/lib/{typescript → types}/parse/validation/validators/options.d.ts +1 -1
- package/lib/{typescript → types}/parse/validation/validators/options.d.ts.map +1 -1
- package/lib/{typescript → types}/parse/validation/validators/requires.d.ts +3 -3
- package/lib/{typescript → types}/parse/validation/validators/requires.d.ts.map +1 -1
- package/lib/{typescript → types}/types/definitions-types.d.ts +35 -4
- package/lib/types/types/definitions-types.d.ts.map +1 -0
- package/lib/types/types/error-types.d.ts +275 -0
- package/lib/types/types/error-types.d.ts.map +1 -0
- package/lib/{typescript → types}/types/io-types.d.ts +1 -1
- package/lib/types/types/types.d.ts +146 -0
- package/lib/types/types/types.d.ts.map +1 -0
- package/lib/{typescript → types}/types/utilities-types.d.ts +0 -2
- package/lib/{typescript → types}/types/utilities-types.d.ts.map +1 -1
- package/lib/types/utilities/parse-argv.d.ts +3 -0
- package/lib/types/utilities/parse-argv.d.ts.map +1 -0
- package/lib/types/utilities/schema-utilities.d.ts +15 -0
- package/lib/types/utilities/schema-utilities.d.ts.map +1 -0
- package/lib/{typescript → types/utilities}/utilities.d.ts +12 -15
- package/lib/types/utilities/utilities.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/autocomplete-scripts/bash-autocomplete-script.ts +14 -12
- package/src/autocomplete-scripts/powershell-autocomplete-script.ts +67 -33
- package/src/autocomplete-scripts/zsh-autocomplete-script.ts +39 -31
- package/src/cli-error/cli-error.ts +44 -0
- package/src/cli-error/error-cause.ts +10 -0
- package/src/cli-error/error-code/definition-error-code.ts +21 -0
- package/src/cli-error/error-code/internal-error-code.ts +8 -0
- package/src/cli-error/error-code/parse-error-code.ts +16 -0
- package/src/cli-error/error-code/validation-error-code.ts +15 -0
- package/src/cli-error/error-message/definition-error-message.ts +144 -0
- package/src/cli-error/error-message/internal-error-message.ts +19 -0
- package/src/cli-error/error-message/parse-error-message.ts +76 -0
- package/src/cli-error/error-message/validation-error-message.ts +104 -0
- package/src/coerce/coerce-methods.ts +194 -39
- package/src/coerce/string-to-array.ts +2 -2
- package/src/coerce/string-to-primitive.ts +72 -13
- package/src/coerce/string-to-set.ts +2 -2
- package/src/definitions/define-arguments.ts +1 -1
- package/src/definitions/define-cli.ts +65 -30
- package/src/definitions/define-options.ts +1 -1
- package/src/definitions/define-subcommand.ts +47 -17
- package/src/definitions/validate-cli-definition.ts +287 -172
- package/src/help-message/format-arguments.ts +1 -1
- package/src/help-message/format-options.ts +1 -1
- package/src/help-message/format-subcommands.ts +1 -1
- package/src/help-message/generate-for-cli.ts +1 -1
- package/src/help-message/terminal-markdown.ts +3 -4
- package/src/index.ts +16 -0
- package/src/markdown/generate-markdown.ts +5 -4
- package/src/metadata/arguments-metadata.ts +2 -1
- package/src/metadata/options-metadata.ts +2 -1
- package/src/parse/context/cli-context-builder.ts +166 -39
- package/src/parse/context/object-context-builder.ts +37 -11
- package/src/parse/parser-utilities.ts +24 -10
- package/src/parse/safe-parse.ts +3 -6
- package/src/parse/validation/validate-context.ts +1 -1
- package/src/parse/validation/validators/arguments.ts +42 -14
- package/src/parse/validation/validators/conflict.ts +11 -20
- package/src/parse/validation/validators/exclusive.ts +16 -25
- package/src/parse/validation/validators/options.ts +40 -12
- package/src/parse/validation/validators/requires.ts +11 -20
- package/src/types/definitions-types.ts +36 -8
- package/src/types/error-types.ts +326 -0
- package/src/types/io-types.ts +1 -1
- package/src/types/types.ts +100 -7
- package/src/types/utilities-types.ts +0 -10
- package/src/utilities/parse-argv.ts +79 -0
- package/src/utilities/schema-utilities.ts +72 -0
- package/src/{utilities.ts → utilities/utilities.ts} +25 -138
- package/lib/cjs/autocomplete-scripts/bash-autocomplete-script.cjs +0 -2
- package/lib/cjs/autocomplete-scripts/bash-autocomplete-script.cjs.map +0 -1
- package/lib/cjs/autocomplete-scripts/powershell-autocomplete-script.cjs +0 -2
- package/lib/cjs/autocomplete-scripts/powershell-autocomplete-script.cjs.map +0 -1
- package/lib/cjs/autocomplete-scripts/zsh-autocomplete-script.cjs +0 -42
- package/lib/cjs/autocomplete-scripts/zsh-autocomplete-script.cjs.map +0 -1
- package/lib/cjs/coerce/coerce-methods.cjs +0 -2
- package/lib/cjs/coerce/coerce-methods.cjs.map +0 -1
- package/lib/cjs/coerce/string-to-array.cjs +0 -2
- package/lib/cjs/coerce/string-to-array.cjs.map +0 -1
- package/lib/cjs/coerce/string-to-primitive.cjs +0 -2
- package/lib/cjs/coerce/string-to-primitive.cjs.map +0 -1
- package/lib/cjs/coerce/string-to-set.cjs +0 -2
- package/lib/cjs/coerce/string-to-set.cjs.map +0 -1
- package/lib/cjs/definitions/define-arguments.cjs +0 -2
- package/lib/cjs/definitions/define-arguments.cjs.map +0 -1
- package/lib/cjs/definitions/define-cli.cjs +0 -2
- package/lib/cjs/definitions/define-cli.cjs.map +0 -1
- package/lib/cjs/definitions/define-options.cjs +0 -2
- package/lib/cjs/definitions/define-options.cjs.map +0 -1
- package/lib/cjs/definitions/define-subcommand.cjs +0 -2
- package/lib/cjs/definitions/define-subcommand.cjs.map +0 -1
- package/lib/cjs/definitions/validate-cli-definition.cjs +0 -2
- package/lib/cjs/definitions/validate-cli-definition.cjs.map +0 -1
- package/lib/cjs/help-message/format-arguments.cjs +0 -2
- package/lib/cjs/help-message/format-arguments.cjs.map +0 -1
- package/lib/cjs/help-message/format-options.cjs +0 -2
- package/lib/cjs/help-message/format-options.cjs.map +0 -1
- package/lib/cjs/help-message/format-subcommands.cjs +0 -2
- package/lib/cjs/help-message/format-subcommands.cjs.map +0 -1
- package/lib/cjs/help-message/generate-for-cli.cjs +0 -2
- package/lib/cjs/help-message/generate-for-cli.cjs.map +0 -1
- package/lib/cjs/help-message/generate-for-subcommand.cjs +0 -2
- package/lib/cjs/help-message/generate-for-subcommand.cjs.map +0 -1
- package/lib/cjs/help-message/print-help.cjs +0 -2
- package/lib/cjs/help-message/print-help.cjs.map +0 -1
- package/lib/cjs/help-message/set-defaults.cjs +0 -2
- package/lib/cjs/help-message/set-defaults.cjs.map +0 -1
- package/lib/cjs/help-message/styles.cjs +0 -2
- package/lib/cjs/help-message/styles.cjs.map +0 -1
- package/lib/cjs/help-message/terminal-markdown.cjs +0 -2
- package/lib/cjs/help-message/terminal-markdown.cjs.map +0 -1
- package/lib/cjs/index.cjs +0 -2
- package/lib/cjs/index.cjs.map +0 -1
- package/lib/cjs/markdown/generate-markdown.cjs +0 -2
- package/lib/cjs/markdown/generate-markdown.cjs.map +0 -1
- package/lib/cjs/metadata/arguments-metadata.cjs +0 -2
- package/lib/cjs/metadata/arguments-metadata.cjs.map +0 -1
- package/lib/cjs/metadata/cli-metadata.cjs +0 -2
- package/lib/cjs/metadata/cli-metadata.cjs.map +0 -1
- package/lib/cjs/metadata/options-metadata.cjs +0 -2
- package/lib/cjs/metadata/options-metadata.cjs.map +0 -1
- package/lib/cjs/metadata/subcommands-metadata.cjs +0 -2
- package/lib/cjs/metadata/subcommands-metadata.cjs.map +0 -1
- package/lib/cjs/parse/context/cli-context-builder.cjs +0 -2
- package/lib/cjs/parse/context/cli-context-builder.cjs.map +0 -1
- package/lib/cjs/parse/context/object-context-builder.cjs +0 -2
- package/lib/cjs/parse/context/object-context-builder.cjs.map +0 -1
- package/lib/cjs/parse/parser-utilities.cjs +0 -2
- package/lib/cjs/parse/parser-utilities.cjs.map +0 -1
- package/lib/cjs/parse/safe-parse.cjs +0 -2
- package/lib/cjs/parse/safe-parse.cjs.map +0 -1
- package/lib/cjs/parse/validation/validate-context.cjs +0 -2
- package/lib/cjs/parse/validation/validate-context.cjs.map +0 -1
- package/lib/cjs/parse/validation/validators/arguments.cjs +0 -2
- package/lib/cjs/parse/validation/validators/arguments.cjs.map +0 -1
- package/lib/cjs/parse/validation/validators/conflict.cjs +0 -2
- package/lib/cjs/parse/validation/validators/conflict.cjs.map +0 -1
- package/lib/cjs/parse/validation/validators/exclusive.cjs +0 -2
- package/lib/cjs/parse/validation/validators/exclusive.cjs.map +0 -1
- package/lib/cjs/parse/validation/validators/explicitly-passed.cjs +0 -2
- package/lib/cjs/parse/validation/validators/explicitly-passed.cjs.map +0 -1
- package/lib/cjs/parse/validation/validators/options.cjs +0 -2
- package/lib/cjs/parse/validation/validators/options.cjs.map +0 -1
- package/lib/cjs/parse/validation/validators/requires.cjs +0 -2
- package/lib/cjs/parse/validation/validators/requires.cjs.map +0 -1
- package/lib/cjs/utilities.cjs +0 -2
- package/lib/cjs/utilities.cjs.map +0 -1
- package/lib/esm/utilities.js +0 -2
- package/lib/esm/utilities.js.map +0 -1
- package/lib/mjs/utilities.mjs +0 -2
- package/lib/mjs/utilities.mjs.map +0 -1
- package/lib/typescript/autocomplete-scripts/powershell-autocomplete-script.d.ts +0 -14
- package/lib/typescript/autocomplete-scripts/zsh-autocomplete-script.d.ts +0 -11
- package/lib/typescript/coerce/coerce-methods.d.ts +0 -20
- package/lib/typescript/coerce/coerce-methods.d.ts.map +0 -1
- package/lib/typescript/coerce/string-to-array.d.ts.map +0 -1
- package/lib/typescript/coerce/string-to-primitive.d.ts +0 -5
- package/lib/typescript/coerce/string-to-primitive.d.ts.map +0 -1
- package/lib/typescript/definitions/define-cli.d.ts.map +0 -1
- package/lib/typescript/definitions/define-subcommand.d.ts.map +0 -1
- package/lib/typescript/definitions/validate-cli-definition.d.ts.map +0 -1
- package/lib/typescript/parse/context/object-context-builder.d.ts.map +0 -1
- package/lib/typescript/types/definitions-types.d.ts.map +0 -1
- package/lib/typescript/types/types.d.ts +0 -61
- package/lib/typescript/types/types.d.ts.map +0 -1
- package/lib/typescript/utilities.d.ts.map +0 -1
- /package/lib/{typescript → types}/autocomplete-scripts/bash-autocomplete-script.d.ts +0 -0
- /package/lib/{typescript → types}/definitions/define-arguments.d.ts +0 -0
- /package/lib/{typescript → types}/definitions/define-arguments.d.ts.map +0 -0
- /package/lib/{typescript → types}/definitions/define-options.d.ts +0 -0
- /package/lib/{typescript → types}/definitions/define-options.d.ts.map +0 -0
- /package/lib/{typescript → types}/help-message/format-arguments.d.ts +0 -0
- /package/lib/{typescript → types}/help-message/format-arguments.d.ts.map +0 -0
- /package/lib/{typescript → types}/help-message/format-options.d.ts +0 -0
- /package/lib/{typescript → types}/help-message/format-options.d.ts.map +0 -0
- /package/lib/{typescript → types}/help-message/format-subcommands.d.ts +0 -0
- /package/lib/{typescript → types}/help-message/format-subcommands.d.ts.map +0 -0
- /package/lib/{typescript → types}/help-message/generate-for-cli.d.ts +0 -0
- /package/lib/{typescript → types}/help-message/generate-for-cli.d.ts.map +0 -0
- /package/lib/{typescript → types}/help-message/generate-for-subcommand.d.ts +0 -0
- /package/lib/{typescript → types}/help-message/generate-for-subcommand.d.ts.map +0 -0
- /package/lib/{typescript → types}/help-message/print-help.d.ts +0 -0
- /package/lib/{typescript → types}/help-message/print-help.d.ts.map +0 -0
- /package/lib/{typescript → types}/help-message/set-defaults.d.ts +0 -0
- /package/lib/{typescript → types}/help-message/set-defaults.d.ts.map +0 -0
- /package/lib/{typescript → types}/help-message/styles.d.ts +0 -0
- /package/lib/{typescript → types}/help-message/styles.d.ts.map +0 -0
- /package/lib/{typescript → types}/help-message/terminal-markdown.d.ts +0 -0
- /package/lib/{typescript → types}/markdown/generate-markdown.d.ts +0 -0
- /package/lib/{typescript → types}/markdown/generate-markdown.d.ts.map +0 -0
- /package/lib/{typescript → types}/metadata/arguments-metadata.d.ts +0 -0
- /package/lib/{typescript → types}/metadata/cli-metadata.d.ts +0 -0
- /package/lib/{typescript → types}/metadata/cli-metadata.d.ts.map +0 -0
- /package/lib/{typescript → types}/metadata/options-metadata.d.ts +0 -0
- /package/lib/{typescript → types}/metadata/subcommands-metadata.d.ts +0 -0
- /package/lib/{typescript → types}/metadata/subcommands-metadata.d.ts.map +0 -0
- /package/lib/{typescript → types}/parse/safe-parse.d.ts +0 -0
- /package/lib/{typescript → types}/parse/validation/validators/explicitly-passed.d.ts +0 -0
- /package/lib/{typescript → types}/parse/validation/validators/explicitly-passed.d.ts.map +0 -0
- /package/lib/{typescript → types}/types/context-types.d.ts +0 -0
- /package/lib/{typescript → types}/types/context-types.d.ts.map +0 -0
- /package/lib/{typescript → types}/types/help-message-types.d.ts +0 -0
- /package/lib/{typescript → types}/types/help-message-types.d.ts.map +0 -0
- /package/lib/{typescript → types}/types/io-types.d.ts.map +0 -0
- /package/lib/{typescript → types}/types/metadata-types.d.ts +0 -0
- /package/lib/{typescript → types}/types/metadata-types.d.ts.map +0 -0
- /package/lib/{typescript → types}/types/schema-types.d.ts +0 -0
- /package/lib/{typescript → types}/types/schema-types.d.ts.map +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["utilities_exports","validateSync","schema","value","results","validate","Promise","TypeError","defaultValueAndIsOptional","issues","defaultValue","optional","PrepareType","coerceHandler","coerceTo","type","prepareDefinitionTypes","definition","object","Object","values","coerce","_preparedType","toKebabCase","input","replace","toLowerCase","generateOrdinalSuffix","index","number","lastTwoDigits","suffix","ln","count","repeat","indent","indentLines","text","spaces","stringifyValue","Set","Array","from","map","element","join","JSON","stringify","insertAtEndOfFirstLine","string","insert","lines","split","subcommandPlaceholder","metadata","placeholder","options","length","arguments","allowPositionals","parseArgv","argv","currentQuote","currentArgument","char","previousChar","nextChar","end","push","escapeHtmlTags","markdown","escapeMap","fullMatch","code","comment","tag","ch","ansiRegex","onlyFirst","ST","String","raw","osc","csi","RegExp","__export","findDuplicateStrings","stripAnsi","module","exports","__toCommonJS","regex","seen","duplicates","has","add"],"sources":["../../src/utilities.ts"],"sourcesContent":["import type { Argument, Option, PreparedType } from \"./types/definitions-types.ts\";\nimport type { SubcommandMetadata } from \"./types/metadata-types.ts\";\nimport type { SchemaResult, SchemaType } from \"./types/schema-types.ts\";\nimport type { CoerceMethod } from \"./types/types.ts\";\n\n/** @throws */\nexport function validateSync(schema: SchemaType, value?: unknown): SchemaResult {\n const results = schema[\"~standard\"].validate(value);\n if (results instanceof Promise) {\n throw new TypeError(\"async schema validation not supported\");\n }\n\n return results;\n}\n\nexport function defaultValueAndIsOptional(schema: SchemaType): { defaultValue: unknown; optional: boolean } {\n const results = validateSync(schema);\n\n if (results.issues) {\n return { defaultValue: undefined, optional: false };\n }\n\n return { defaultValue: results.value, optional: true };\n}\n\nexport function PrepareType(schema: SchemaType, coerceHandler: CoerceMethod<unknown>): PreparedType {\n const { optional, defaultValue } = defaultValueAndIsOptional(schema);\n\n return {\n schema,\n optional,\n defaultValue,\n coerceTo: coerceHandler.type,\n validate: (value?: string) => validateSync(schema, value && coerceHandler(value)),\n };\n}\n\nexport function prepareDefinitionTypes(definition: Record<string, Argument> | Record<string, Option> | undefined) {\n if (!definition) return;\n\n for (const object of Object.values<Argument | Option>(definition)) {\n if (!object.coerce) {\n object.coerce = (value: string) => value;\n }\n\n if (!object._preparedType) {\n object._preparedType = PrepareType(object.schema, object.coerce);\n }\n }\n}\n\nexport function toKebabCase(input: string): string {\n return input.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Converts a zero-based index into its human-readable ordinal form.\n *\n * Examples: 0 → \"1st\" 1 → \"2nd\" 2 → \"3rd\" 3 → \"4th\" 10 → \"11th\"\n *\n * Handles special cases for 11, 12, and 13.\n *\n * @param index - The zero-based index to convert.\n * @returns The ordinal string (e.g., \"1st\", \"2nd\", \"3rd\", \"4th\", ...).\n */\nexport function generateOrdinalSuffix(index: number): string {\n if (index < 0) return \"\";\n\n const number = index + 1;\n const lastDigit = number % 10;\n const lastTwoDigits = number % 100;\n\n let suffix = \"th\";\n\n if (lastTwoDigits < 11 || lastTwoDigits > 13) {\n switch (lastDigit) {\n case 1: {\n suffix = \"st\";\n break;\n }\n case 2: {\n suffix = \"nd\";\n break;\n }\n case 3: {\n suffix = \"rd\";\n break;\n }\n }\n }\n\n return `${number}${suffix}`;\n}\n\n/** New line */\nexport function ln(count: number) {\n return \"\\n\".repeat(count);\n}\n\n/** Space */\nexport function indent(count: number) {\n if (count <= 0) return \"\";\n return \" \".repeat(count);\n}\n\n/** Indents every line in the given text by the provided number of spaces. Empty lines are preserved. */\nexport function indentLines(text: string, spaces: number): string {\n return text.replace(/\\n/g, \"\\n\" + indent(spaces));\n}\n\nexport function stringifyValue(value: unknown): string {\n // Set\n if (value instanceof Set) {\n return (\n \"new Set([\" +\n Array.from(value)\n .map(element => stringifyValue(element))\n .join(\", \") +\n \"])\"\n );\n }\n\n // unknown\n return JSON.stringify(value);\n}\n\n/** Insert text at the end of the first line */\nexport function insertAtEndOfFirstLine(string: string, insert: string) {\n const lines = string.split(\"\\n\");\n lines[0] += (lines[0] ? \" \" : \"\") + insert;\n return lines.join(\"\\n\");\n}\n\n/** Get the placeholder for a subcommand */\nexport function subcommandPlaceholder(metadata: SubcommandMetadata): string {\n let placeholder = metadata.placeholder;\n\n if (placeholder) {\n return placeholder;\n }\n\n if (metadata.options.length > 0) {\n placeholder += (placeholder ? \" \" : \"\") + \"[options]\";\n }\n\n if (metadata.arguments.length > 0) {\n placeholder += (placeholder ? \" \" : \"\") + \"<arguments>\";\n }\n\n if (metadata.allowPositionals) {\n placeholder += (placeholder ? \" \" : \"\") + \"<positionals>\";\n }\n\n if (!placeholder) {\n placeholder = \" \";\n }\n\n return placeholder;\n}\n\n/** Parse a string into an argv (array of arguments) */\nexport function parseArgv(input: string): string[] {\n const argv = [];\n\n let currentQuote: string | undefined = undefined;\n let currentArgument: string | undefined = undefined;\n\n for (let index = 0; index < input.length; index++) {\n const char = input[index];\n const previousChar = input[index - 1];\n const nextChar = input[index + 1];\n const end = index === input.length - 1;\n\n // entering/leaving quote\n if ((char === '\"' || char === \"'\") && previousChar !== \"\\\\\") {\n // leaving quote\n if (currentQuote === char) {\n currentQuote = undefined;\n continue;\n }\n\n // entering quote\n if (currentQuote === undefined) {\n currentQuote = char;\n continue;\n }\n\n // quote inside quote\n if (currentQuote !== undefined && char !== currentQuote) {\n currentArgument += char;\n continue;\n }\n continue;\n }\n\n // new line\n if (char === \"\\\\\" && nextChar === \"\\n\") {\n index++;\n continue;\n }\n\n // Add to argv\n if (currentArgument !== undefined && currentQuote === undefined) {\n if (char === \" \") {\n argv.push(currentArgument);\n currentArgument = undefined;\n continue;\n }\n\n if (end) {\n currentArgument += char;\n argv.push(currentArgument);\n currentArgument = undefined;\n continue;\n }\n }\n\n // Ignore spaces outside of quotes\n if (char === \" \" && currentQuote === undefined) {\n continue;\n }\n\n // Ignore escaped characters\n if (char === \"\\\\\" && (nextChar === \"'\" || nextChar === '\"')) {\n continue;\n }\n\n currentArgument ??= \"\";\n currentArgument += char;\n }\n\n // Add last argument\n if (currentArgument !== undefined) {\n argv.push(currentArgument);\n }\n\n return argv;\n}\n\n/**\n * Escape HTML characters inside HTML tags in a Markdown string, but leave code blocks, inline code, and HTML comments\n * unchanged.\n */\nexport function escapeHtmlTags(markdown: string): string {\n const escapeMap: Record<string, string> = { \"&\": \"&\", \"<\": \"<\", \">\": \">\" };\n\n // Captures:\n // 1) fenced code blocks or inline code\n // 2) HTML comments <!-- ... -->\n // 3) other HTML tags like <b>, <div attr=\"x\">, etc.\n const re = /(```[\\s\\S]*?```|`[^`]*`)|(<!--[\\s\\S]*?-->)|(<[^>]+>)/g;\n\n return markdown.replace(re, (fullMatch: string, code?: string, comment?: string, tag?: string) => {\n if (code) return code;\n if (comment) return comment;\n if (!tag) return fullMatch;\n\n return tag.replace(/[&<>]/g, ch => escapeMap[ch]);\n });\n}\n\n/** Credits: https://github.com/chalk/ansi-regex */\nfunction ansiRegex({ onlyFirst = false } = {}) {\n // Valid string terminator sequences are BEL, ESC\\, and 0x9c\n const ST = String.raw`(?:\\u0007|\\u001B\\u005C|\\u009C)`;\n\n // OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n const osc = String.raw`(?:\\u001B\\][\\s\\S]*?${ST})`;\n\n // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n const csi = String.raw`[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`;\n\n const pattern = `${osc}|${csi}`;\n\n return new RegExp(pattern, onlyFirst ? undefined : \"g\");\n}\n\nconst regex = ansiRegex();\n\nexport function stripAnsi(string: string): string {\n return string.replace(regex, \"\");\n}\n\nexport function findDuplicateStrings(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const duplicates = new Set<string>();\n\n for (const value of values) {\n if (seen.has(value)) {\n duplicates.add(value);\n continue;\n }\n\n seen.add(value);\n }\n\n return Array.from(duplicates);\n}\n"],"mappings":"8iBAAAA,kBAAA,GAMO,SAASC,aAAaC,EAAoBC,GAC/C,MAAMC,EAAUF,EAAO,aAAaG,SAASF,GAC7C,GAAIC,aAAmBE,QACrB,MAAM,IAAIC,UAAU,yCAGtB,OAAOH,CACT,CAEO,SAASI,0BAA0BN,GACxC,MAAME,EAAUH,aAAaC,GAE7B,OAAIE,EAAQK,OACH,CAAEC,kBAAc,EAAWC,UAAU,GAGvC,CAAED,aAAcN,EAAQD,MAAOQ,UAAU,EAClD,CAEO,SAASC,YAAYV,EAAoBW,GAC9C,MAAMF,SAAEA,EAAAD,aAAUA,GAAiBF,0BAA0BN,GAE7D,MAAO,CACLA,SACAS,WACAD,eACAI,SAAUD,EAAcE,KACxBV,SAAWF,GAAmBF,aAAaC,EAAQC,GAASU,EAAcV,IAE9E,CAEO,SAASa,uBAAuBC,GACrC,GAAKA,EAEL,UAAWC,KAAUC,OAAOC,OAA0BH,GAC/CC,EAAOG,SACVH,EAAOG,OAAUlB,GAAkBA,GAGhCe,EAAOI,gBACVJ,EAAOI,cAAgBV,YAAY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AAIG,OAFK,GAAGF,KAAOC,IAECL,OAAY,EAAY,IACrD,CAnRAO,SAAArF,kBAAA,CAAAY,YAAA,IAAAA,YAAAJ,0BAAA,IAAAA,0BAAA6D,eAAA,IAAAA,eAAAiB,qBAAA,IAAAA,qBAAA3D,sBAAA,IAAAA,sBAAAQ,OAAA,IAAAA,OAAAC,YAAA,IAAAA,YAAAY,uBAAA,IAAAA,uBAAAhB,GAAA,IAAAA,GAAA4B,UAAA,IAAAA,UAAA5C,uBAAA,IAAAA,uBAAAuB,eAAA,IAAAA,eAAAgD,UAAA,IAAAA,UAAAlC,sBAAA,IAAAA,sBAAA9B,YAAA,IAAAA,YAAAtB,aAAA,IAAAA,eAAAuF,OAAAC,QAAAC,aAAA1F,mBAqRA,IAAM2F,MAAQd,YAEP,SAASU,UAAUtC,GACxB,OAAOA,EAAOxB,QAAQkE,MAAO,GAC/B,CAEO,SAASL,qBAAqBlE,GACnC,MAAMwE,EAAO,IAAIpD,IACXqD,EAAa,IAAIrD,IAEvB,UAAWrC,KAASiB,EACdwE,EAAKE,IAAI3F,GACX0F,EAAWE,IAAI5F,GAIjByF,EAAKG,IAAI5F,GAGX,OAAOsC,MAAMC,KAAKmD,EACpB","ignoreList":[]}
|
package/lib/esm/utilities.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function validateSync(e,n){const t=e["~standard"].validate(n);if(t instanceof Promise)throw new TypeError("async schema validation not supported");return t}function defaultValueAndIsOptional(e){const n=validateSync(e);return n.issues?{defaultValue:void 0,optional:!1}:{defaultValue:n.value,optional:!0}}function PrepareType(e,n){const{optional:t,defaultValue:i}=defaultValueAndIsOptional(e);return{schema:e,optional:t,defaultValue:i,coerceTo:n.type,validate:t=>validateSync(e,t&&n(t))}}function prepareDefinitionTypes(e){if(e)for(const n of Object.values(e))n.coerce||(n.coerce=e=>e),n._preparedType||(n._preparedType=PrepareType(n.schema,n.coerce))}function toKebabCase(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function generateOrdinalSuffix(e){if(e<0)return"";const n=e+1,t=n%100;let i="th";if(t<11||t>13)switch(n%10){case 1:i="st";break;case 2:i="nd";break;case 3:i="rd"}return`${n}${i}`}function ln(e){return"\n".repeat(e)}function indent(e){return e<=0?"":" ".repeat(e)}function indentLines(e,n){return e.replace(/\n/g,"\n"+indent(n))}function stringifyValue(e){return e instanceof Set?"new Set(["+Array.from(e).map(e=>stringifyValue(e)).join(", ")+"])":JSON.stringify(e)}function insertAtEndOfFirstLine(e,n){const t=e.split("\n");return t[0]+=(t[0]?" ":"")+n,t.join("\n")}function subcommandPlaceholder(e){let n=e.placeholder;return n||(e.options.length>0&&(n+=(n?" ":"")+"[options]"),e.arguments.length>0&&(n+=(n?" ":"")+"<arguments>"),e.allowPositionals&&(n+=(n?" ":"")+"<positionals>"),n||(n=" "),n)}function parseArgv(e){const n=[];let t,i;for(let r=0;r<e.length;r++){const a=e[r],o=e[r-1],s=e[r+1],u=r===e.length-1;if('"'!==a&&"'"!==a||"\\"===o)if("\\"!==a||"\n"!==s){if(void 0!==i&&void 0===t){if(" "===a){n.push(i),i=void 0;continue}if(u){i+=a,n.push(i),i=void 0;continue}}" "===a&&void 0===t||("\\"!==a||"'"!==s&&'"'!==s)&&(i??(i=""),i+=a)}else r++;else{if(t===a){t=void 0;continue}if(void 0===t){t=a;continue}if(void 0!==t&&a!==t){i+=a;continue}}}return void 0!==i&&n.push(i),n}function escapeHtmlTags(e){const n={"&":"&","<":"<",">":">"};return e.replace(/(```[\s\S]*?```|`[^`]*`)|(<!--[\s\S]*?-->)|(<[^>]+>)/g,(e,t,i,r)=>t||(i||(r?r.replace(/[&<>]/g,e=>n[e]):e)))}function ansiRegex({onlyFirst:e=!1}={}){const n=String.raw`(?:\u0007|\u001B\u005C|\u009C)`,t=String.raw`(?:\u001B\][\s\S]*?${n})`,i=String.raw`[\u001B\u009B][[\]()#;?]*(?:\d{1,4}(?:[;:]\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]`;return new RegExp(`${t}|${i}`,e?void 0:"g")}var regex=ansiRegex();function stripAnsi(e){return e.replace(regex,"")}function findDuplicateStrings(e){const n=new Set,t=new Set;for(const i of e)n.has(i)?t.add(i):n.add(i);return Array.from(t)}export{PrepareType,defaultValueAndIsOptional,escapeHtmlTags,findDuplicateStrings,generateOrdinalSuffix,indent,indentLines,insertAtEndOfFirstLine,ln,parseArgv,prepareDefinitionTypes,stringifyValue,stripAnsi,subcommandPlaceholder,toKebabCase,validateSync};
|
|
2
|
-
//# sourceMappingURL=utilities.js.map
|
package/lib/esm/utilities.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["validateSync","schema","value","results","validate","Promise","TypeError","defaultValueAndIsOptional","issues","defaultValue","optional","PrepareType","coerceHandler","coerceTo","type","prepareDefinitionTypes","definition","object","Object","values","coerce","_preparedType","toKebabCase","input","replace","toLowerCase","generateOrdinalSuffix","index","number","lastTwoDigits","suffix","ln","count","repeat","indent","indentLines","text","spaces","stringifyValue","Set","Array","from","map","element","join","JSON","stringify","insertAtEndOfFirstLine","string","insert","lines","split","subcommandPlaceholder","metadata","placeholder","options","length","arguments","allowPositionals","parseArgv","argv","currentQuote","currentArgument","char","previousChar","nextChar","end","push","escapeHtmlTags","markdown","escapeMap","fullMatch","code","comment","tag","ch","ansiRegex","onlyFirst","ST","String","raw","osc","csi","RegExp","regex","stripAnsi","findDuplicateStrings","seen","duplicates","has","add"],"sources":["../../src/utilities.ts"],"sourcesContent":["import type { Argument, Option, PreparedType } from \"./types/definitions-types.ts\";\nimport type { SubcommandMetadata } from \"./types/metadata-types.ts\";\nimport type { SchemaResult, SchemaType } from \"./types/schema-types.ts\";\nimport type { CoerceMethod } from \"./types/types.ts\";\n\n/** @throws */\nexport function validateSync(schema: SchemaType, value?: unknown): SchemaResult {\n const results = schema[\"~standard\"].validate(value);\n if (results instanceof Promise) {\n throw new TypeError(\"async schema validation not supported\");\n }\n\n return results;\n}\n\nexport function defaultValueAndIsOptional(schema: SchemaType): { defaultValue: unknown; optional: boolean } {\n const results = validateSync(schema);\n\n if (results.issues) {\n return { defaultValue: undefined, optional: false };\n }\n\n return { defaultValue: results.value, optional: true };\n}\n\nexport function PrepareType(schema: SchemaType, coerceHandler: CoerceMethod<unknown>): PreparedType {\n const { optional, defaultValue } = defaultValueAndIsOptional(schema);\n\n return {\n schema,\n optional,\n defaultValue,\n coerceTo: coerceHandler.type,\n validate: (value?: string) => validateSync(schema, value && coerceHandler(value)),\n };\n}\n\nexport function prepareDefinitionTypes(definition: Record<string, Argument> | Record<string, Option> | undefined) {\n if (!definition) return;\n\n for (const object of Object.values<Argument | Option>(definition)) {\n if (!object.coerce) {\n object.coerce = (value: string) => value;\n }\n\n if (!object._preparedType) {\n object._preparedType = PrepareType(object.schema, object.coerce);\n }\n }\n}\n\nexport function toKebabCase(input: string): string {\n return input.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Converts a zero-based index into its human-readable ordinal form.\n *\n * Examples: 0 → \"1st\" 1 → \"2nd\" 2 → \"3rd\" 3 → \"4th\" 10 → \"11th\"\n *\n * Handles special cases for 11, 12, and 13.\n *\n * @param index - The zero-based index to convert.\n * @returns The ordinal string (e.g., \"1st\", \"2nd\", \"3rd\", \"4th\", ...).\n */\nexport function generateOrdinalSuffix(index: number): string {\n if (index < 0) return \"\";\n\n const number = index + 1;\n const lastDigit = number % 10;\n const lastTwoDigits = number % 100;\n\n let suffix = \"th\";\n\n if (lastTwoDigits < 11 || lastTwoDigits > 13) {\n switch (lastDigit) {\n case 1: {\n suffix = \"st\";\n break;\n }\n case 2: {\n suffix = \"nd\";\n break;\n }\n case 3: {\n suffix = \"rd\";\n break;\n }\n }\n }\n\n return `${number}${suffix}`;\n}\n\n/** New line */\nexport function ln(count: number) {\n return \"\\n\".repeat(count);\n}\n\n/** Space */\nexport function indent(count: number) {\n if (count <= 0) return \"\";\n return \" \".repeat(count);\n}\n\n/** Indents every line in the given text by the provided number of spaces. Empty lines are preserved. */\nexport function indentLines(text: string, spaces: number): string {\n return text.replace(/\\n/g, \"\\n\" + indent(spaces));\n}\n\nexport function stringifyValue(value: unknown): string {\n // Set\n if (value instanceof Set) {\n return (\n \"new Set([\" +\n Array.from(value)\n .map(element => stringifyValue(element))\n .join(\", \") +\n \"])\"\n );\n }\n\n // unknown\n return JSON.stringify(value);\n}\n\n/** Insert text at the end of the first line */\nexport function insertAtEndOfFirstLine(string: string, insert: string) {\n const lines = string.split(\"\\n\");\n lines[0] += (lines[0] ? \" \" : \"\") + insert;\n return lines.join(\"\\n\");\n}\n\n/** Get the placeholder for a subcommand */\nexport function subcommandPlaceholder(metadata: SubcommandMetadata): string {\n let placeholder = metadata.placeholder;\n\n if (placeholder) {\n return placeholder;\n }\n\n if (metadata.options.length > 0) {\n placeholder += (placeholder ? \" \" : \"\") + \"[options]\";\n }\n\n if (metadata.arguments.length > 0) {\n placeholder += (placeholder ? \" \" : \"\") + \"<arguments>\";\n }\n\n if (metadata.allowPositionals) {\n placeholder += (placeholder ? \" \" : \"\") + \"<positionals>\";\n }\n\n if (!placeholder) {\n placeholder = \" \";\n }\n\n return placeholder;\n}\n\n/** Parse a string into an argv (array of arguments) */\nexport function parseArgv(input: string): string[] {\n const argv = [];\n\n let currentQuote: string | undefined = undefined;\n let currentArgument: string | undefined = undefined;\n\n for (let index = 0; index < input.length; index++) {\n const char = input[index];\n const previousChar = input[index - 1];\n const nextChar = input[index + 1];\n const end = index === input.length - 1;\n\n // entering/leaving quote\n if ((char === '\"' || char === \"'\") && previousChar !== \"\\\\\") {\n // leaving quote\n if (currentQuote === char) {\n currentQuote = undefined;\n continue;\n }\n\n // entering quote\n if (currentQuote === undefined) {\n currentQuote = char;\n continue;\n }\n\n // quote inside quote\n if (currentQuote !== undefined && char !== currentQuote) {\n currentArgument += char;\n continue;\n }\n continue;\n }\n\n // new line\n if (char === \"\\\\\" && nextChar === \"\\n\") {\n index++;\n continue;\n }\n\n // Add to argv\n if (currentArgument !== undefined && currentQuote === undefined) {\n if (char === \" \") {\n argv.push(currentArgument);\n currentArgument = undefined;\n continue;\n }\n\n if (end) {\n currentArgument += char;\n argv.push(currentArgument);\n currentArgument = undefined;\n continue;\n }\n }\n\n // Ignore spaces outside of quotes\n if (char === \" \" && currentQuote === undefined) {\n continue;\n }\n\n // Ignore escaped characters\n if (char === \"\\\\\" && (nextChar === \"'\" || nextChar === '\"')) {\n continue;\n }\n\n currentArgument ??= \"\";\n currentArgument += char;\n }\n\n // Add last argument\n if (currentArgument !== undefined) {\n argv.push(currentArgument);\n }\n\n return argv;\n}\n\n/**\n * Escape HTML characters inside HTML tags in a Markdown string, but leave code blocks, inline code, and HTML comments\n * unchanged.\n */\nexport function escapeHtmlTags(markdown: string): string {\n const escapeMap: Record<string, string> = { \"&\": \"&\", \"<\": \"<\", \">\": \">\" };\n\n // Captures:\n // 1) fenced code blocks or inline code\n // 2) HTML comments <!-- ... -->\n // 3) other HTML tags like <b>, <div attr=\"x\">, etc.\n const re = /(```[\\s\\S]*?```|`[^`]*`)|(<!--[\\s\\S]*?-->)|(<[^>]+>)/g;\n\n return markdown.replace(re, (fullMatch: string, code?: string, comment?: string, tag?: string) => {\n if (code) return code;\n if (comment) return comment;\n if (!tag) return fullMatch;\n\n return tag.replace(/[&<>]/g, ch => escapeMap[ch]);\n });\n}\n\n/** Credits: https://github.com/chalk/ansi-regex */\nfunction ansiRegex({ onlyFirst = false } = {}) {\n // Valid string terminator sequences are BEL, ESC\\, and 0x9c\n const ST = String.raw`(?:\\u0007|\\u001B\\u005C|\\u009C)`;\n\n // OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n const osc = String.raw`(?:\\u001B\\][\\s\\S]*?${ST})`;\n\n // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n const csi = String.raw`[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`;\n\n const pattern = `${osc}|${csi}`;\n\n return new RegExp(pattern, onlyFirst ? undefined : \"g\");\n}\n\nconst regex = ansiRegex();\n\nexport function stripAnsi(string: string): string {\n return string.replace(regex, \"\");\n}\n\nexport function findDuplicateStrings(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const duplicates = new Set<string>();\n\n for (const value of values) {\n if (seen.has(value)) {\n duplicates.add(value);\n continue;\n }\n\n seen.add(value);\n }\n\n return Array.from(duplicates);\n}\n"],"mappings":"AAMO,SAASA,aAAaC,EAAoBC,GAC/C,MAAMC,EAAUF,EAAO,aAAaG,SAASF,GAC7C,GAAIC,aAAmBE,QACrB,MAAM,IAAIC,UAAU,yCAGtB,OAAOH,CACT,CAEO,SAASI,0BAA0BN,GACxC,MAAME,EAAUH,aAAaC,GAE7B,OAAIE,EAAQK,OACH,CAAEC,kBAAc,EAAWC,UAAU,GAGvC,CAAED,aAAcN,EAAQD,MAAOQ,UAAU,EAClD,CAEO,SAASC,YAAYV,EAAoBW,GAC9C,MAAMF,SAAEA,EAAAD,aAAUA,GAAiBF,0BAA0BN,GAE7D,MAAO,CACLA,SACAS,WACAD,eACAI,SAAUD,EAAcE,KACxBV,SAAWF,GAAmBF,aAAaC,EAAQC,GAASU,EAAcV,IAE9E,CAEO,SAASa,uBAAuBC,GACrC,GAAKA,EAEL,UAAWC,KAAUC,OAAOC,OAA0BH,GAC/CC,EAAOG,SACVH,EAAOG,OAAUlB,GAAkBA,GAGhCe,EAAOI,gBACVJ,EAAOI,cAAgBV,YAAYM,EAAOhB,OAAQgB,EAAOG,QAG/D,CAEO,SAASE,YAAYC,GAC1B,OAAOA,EAAMC,QAAQ,kBAAmB,SAASC,aACnD,CAYO,SAASC,sBAAsBC,GACpC,GAAIA,EAAQ,EAAG,MAAO,GAEtB,MAAMC,EAASD,EAAQ,EAEjBE,EAAgBD,EAAS,IAE/B,IAAIE,EAAS,KAEb,GAAID,EAAgB,IAAMA,EAAgB,GACxC,OANgBD,EAAS,IAOvB,K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AAKG,IAAIxF,GAGX,OAAOsC,MAAMC,KAAK+C,EACpB,Q","ignoreList":[]}
|
package/lib/mjs/utilities.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function validateSync(e,n){const t=e["~standard"].validate(n);if(t instanceof Promise)throw new TypeError("async schema validation not supported");return t}function defaultValueAndIsOptional(e){const n=validateSync(e);return n.issues?{defaultValue:void 0,optional:!1}:{defaultValue:n.value,optional:!0}}function PrepareType(e,n){const{optional:t,defaultValue:i}=defaultValueAndIsOptional(e);return{schema:e,optional:t,defaultValue:i,coerceTo:n.type,validate:t=>validateSync(e,t&&n(t))}}function prepareDefinitionTypes(e){if(e)for(const n of Object.values(e))n.coerce||(n.coerce=e=>e),n._preparedType||(n._preparedType=PrepareType(n.schema,n.coerce))}function toKebabCase(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function generateOrdinalSuffix(e){if(e<0)return"";const n=e+1,t=n%100;let i="th";if(t<11||t>13)switch(n%10){case 1:i="st";break;case 2:i="nd";break;case 3:i="rd"}return`${n}${i}`}function ln(e){return"\n".repeat(e)}function indent(e){return e<=0?"":" ".repeat(e)}function indentLines(e,n){return e.replace(/\n/g,"\n"+indent(n))}function stringifyValue(e){return e instanceof Set?"new Set(["+Array.from(e).map(e=>stringifyValue(e)).join(", ")+"])":JSON.stringify(e)}function insertAtEndOfFirstLine(e,n){const t=e.split("\n");return t[0]+=(t[0]?" ":"")+n,t.join("\n")}function subcommandPlaceholder(e){let n=e.placeholder;return n||(e.options.length>0&&(n+=(n?" ":"")+"[options]"),e.arguments.length>0&&(n+=(n?" ":"")+"<arguments>"),e.allowPositionals&&(n+=(n?" ":"")+"<positionals>"),n||(n=" "),n)}function parseArgv(e){const n=[];let t,i;for(let r=0;r<e.length;r++){const a=e[r],o=e[r-1],s=e[r+1],u=r===e.length-1;if('"'!==a&&"'"!==a||"\\"===o)if("\\"!==a||"\n"!==s){if(void 0!==i&&void 0===t){if(" "===a){n.push(i),i=void 0;continue}if(u){i+=a,n.push(i),i=void 0;continue}}" "===a&&void 0===t||("\\"!==a||"'"!==s&&'"'!==s)&&(i??(i=""),i+=a)}else r++;else{if(t===a){t=void 0;continue}if(void 0===t){t=a;continue}if(void 0!==t&&a!==t){i+=a;continue}}}return void 0!==i&&n.push(i),n}function escapeHtmlTags(e){const n={"&":"&","<":"<",">":">"};return e.replace(/(```[\s\S]*?```|`[^`]*`)|(<!--[\s\S]*?-->)|(<[^>]+>)/g,(e,t,i,r)=>t||(i||(r?r.replace(/[&<>]/g,e=>n[e]):e)))}function ansiRegex({onlyFirst:e=!1}={}){const n=String.raw`(?:\u0007|\u001B\u005C|\u009C)`,t=String.raw`(?:\u001B\][\s\S]*?${n})`,i=String.raw`[\u001B\u009B][[\]()#;?]*(?:\d{1,4}(?:[;:]\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]`;return new RegExp(`${t}|${i}`,e?void 0:"g")}var regex=ansiRegex();function stripAnsi(e){return e.replace(regex,"")}function findDuplicateStrings(e){const n=new Set,t=new Set;for(const i of e)n.has(i)?t.add(i):n.add(i);return Array.from(t)}export{PrepareType,defaultValueAndIsOptional,escapeHtmlTags,findDuplicateStrings,generateOrdinalSuffix,indent,indentLines,insertAtEndOfFirstLine,ln,parseArgv,prepareDefinitionTypes,stringifyValue,stripAnsi,subcommandPlaceholder,toKebabCase,validateSync};
|
|
2
|
-
//# sourceMappingURL=utilities.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["validateSync","schema","value","results","validate","Promise","TypeError","defaultValueAndIsOptional","issues","defaultValue","optional","PrepareType","coerceHandler","coerceTo","type","prepareDefinitionTypes","definition","object","Object","values","coerce","_preparedType","toKebabCase","input","replace","toLowerCase","generateOrdinalSuffix","index","number","lastTwoDigits","suffix","ln","count","repeat","indent","indentLines","text","spaces","stringifyValue","Set","Array","from","map","element","join","JSON","stringify","insertAtEndOfFirstLine","string","insert","lines","split","subcommandPlaceholder","metadata","placeholder","options","length","arguments","allowPositionals","parseArgv","argv","currentQuote","currentArgument","char","previousChar","nextChar","end","push","escapeHtmlTags","markdown","escapeMap","fullMatch","code","comment","tag","ch","ansiRegex","onlyFirst","ST","String","raw","osc","csi","RegExp","regex","stripAnsi","findDuplicateStrings","seen","duplicates","has","add"],"sources":["../../src/utilities.ts"],"sourcesContent":["import type { Argument, Option, PreparedType } from \"./types/definitions-types.ts\";\nimport type { SubcommandMetadata } from \"./types/metadata-types.ts\";\nimport type { SchemaResult, SchemaType } from \"./types/schema-types.ts\";\nimport type { CoerceMethod } from \"./types/types.ts\";\n\n/** @throws */\nexport function validateSync(schema: SchemaType, value?: unknown): SchemaResult {\n const results = schema[\"~standard\"].validate(value);\n if (results instanceof Promise) {\n throw new TypeError(\"async schema validation not supported\");\n }\n\n return results;\n}\n\nexport function defaultValueAndIsOptional(schema: SchemaType): { defaultValue: unknown; optional: boolean } {\n const results = validateSync(schema);\n\n if (results.issues) {\n return { defaultValue: undefined, optional: false };\n }\n\n return { defaultValue: results.value, optional: true };\n}\n\nexport function PrepareType(schema: SchemaType, coerceHandler: CoerceMethod<unknown>): PreparedType {\n const { optional, defaultValue } = defaultValueAndIsOptional(schema);\n\n return {\n schema,\n optional,\n defaultValue,\n coerceTo: coerceHandler.type,\n validate: (value?: string) => validateSync(schema, value && coerceHandler(value)),\n };\n}\n\nexport function prepareDefinitionTypes(definition: Record<string, Argument> | Record<string, Option> | undefined) {\n if (!definition) return;\n\n for (const object of Object.values<Argument | Option>(definition)) {\n if (!object.coerce) {\n object.coerce = (value: string) => value;\n }\n\n if (!object._preparedType) {\n object._preparedType = PrepareType(object.schema, object.coerce);\n }\n }\n}\n\nexport function toKebabCase(input: string): string {\n return input.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\n\n/**\n * Converts a zero-based index into its human-readable ordinal form.\n *\n * Examples: 0 → \"1st\" 1 → \"2nd\" 2 → \"3rd\" 3 → \"4th\" 10 → \"11th\"\n *\n * Handles special cases for 11, 12, and 13.\n *\n * @param index - The zero-based index to convert.\n * @returns The ordinal string (e.g., \"1st\", \"2nd\", \"3rd\", \"4th\", ...).\n */\nexport function generateOrdinalSuffix(index: number): string {\n if (index < 0) return \"\";\n\n const number = index + 1;\n const lastDigit = number % 10;\n const lastTwoDigits = number % 100;\n\n let suffix = \"th\";\n\n if (lastTwoDigits < 11 || lastTwoDigits > 13) {\n switch (lastDigit) {\n case 1: {\n suffix = \"st\";\n break;\n }\n case 2: {\n suffix = \"nd\";\n break;\n }\n case 3: {\n suffix = \"rd\";\n break;\n }\n }\n }\n\n return `${number}${suffix}`;\n}\n\n/** New line */\nexport function ln(count: number) {\n return \"\\n\".repeat(count);\n}\n\n/** Space */\nexport function indent(count: number) {\n if (count <= 0) return \"\";\n return \" \".repeat(count);\n}\n\n/** Indents every line in the given text by the provided number of spaces. Empty lines are preserved. */\nexport function indentLines(text: string, spaces: number): string {\n return text.replace(/\\n/g, \"\\n\" + indent(spaces));\n}\n\nexport function stringifyValue(value: unknown): string {\n // Set\n if (value instanceof Set) {\n return (\n \"new Set([\" +\n Array.from(value)\n .map(element => stringifyValue(element))\n .join(\", \") +\n \"])\"\n );\n }\n\n // unknown\n return JSON.stringify(value);\n}\n\n/** Insert text at the end of the first line */\nexport function insertAtEndOfFirstLine(string: string, insert: string) {\n const lines = string.split(\"\\n\");\n lines[0] += (lines[0] ? \" \" : \"\") + insert;\n return lines.join(\"\\n\");\n}\n\n/** Get the placeholder for a subcommand */\nexport function subcommandPlaceholder(metadata: SubcommandMetadata): string {\n let placeholder = metadata.placeholder;\n\n if (placeholder) {\n return placeholder;\n }\n\n if (metadata.options.length > 0) {\n placeholder += (placeholder ? \" \" : \"\") + \"[options]\";\n }\n\n if (metadata.arguments.length > 0) {\n placeholder += (placeholder ? \" \" : \"\") + \"<arguments>\";\n }\n\n if (metadata.allowPositionals) {\n placeholder += (placeholder ? \" \" : \"\") + \"<positionals>\";\n }\n\n if (!placeholder) {\n placeholder = \" \";\n }\n\n return placeholder;\n}\n\n/** Parse a string into an argv (array of arguments) */\nexport function parseArgv(input: string): string[] {\n const argv = [];\n\n let currentQuote: string | undefined = undefined;\n let currentArgument: string | undefined = undefined;\n\n for (let index = 0; index < input.length; index++) {\n const char = input[index];\n const previousChar = input[index - 1];\n const nextChar = input[index + 1];\n const end = index === input.length - 1;\n\n // entering/leaving quote\n if ((char === '\"' || char === \"'\") && previousChar !== \"\\\\\") {\n // leaving quote\n if (currentQuote === char) {\n currentQuote = undefined;\n continue;\n }\n\n // entering quote\n if (currentQuote === undefined) {\n currentQuote = char;\n continue;\n }\n\n // quote inside quote\n if (currentQuote !== undefined && char !== currentQuote) {\n currentArgument += char;\n continue;\n }\n continue;\n }\n\n // new line\n if (char === \"\\\\\" && nextChar === \"\\n\") {\n index++;\n continue;\n }\n\n // Add to argv\n if (currentArgument !== undefined && currentQuote === undefined) {\n if (char === \" \") {\n argv.push(currentArgument);\n currentArgument = undefined;\n continue;\n }\n\n if (end) {\n currentArgument += char;\n argv.push(currentArgument);\n currentArgument = undefined;\n continue;\n }\n }\n\n // Ignore spaces outside of quotes\n if (char === \" \" && currentQuote === undefined) {\n continue;\n }\n\n // Ignore escaped characters\n if (char === \"\\\\\" && (nextChar === \"'\" || nextChar === '\"')) {\n continue;\n }\n\n currentArgument ??= \"\";\n currentArgument += char;\n }\n\n // Add last argument\n if (currentArgument !== undefined) {\n argv.push(currentArgument);\n }\n\n return argv;\n}\n\n/**\n * Escape HTML characters inside HTML tags in a Markdown string, but leave code blocks, inline code, and HTML comments\n * unchanged.\n */\nexport function escapeHtmlTags(markdown: string): string {\n const escapeMap: Record<string, string> = { \"&\": \"&\", \"<\": \"<\", \">\": \">\" };\n\n // Captures:\n // 1) fenced code blocks or inline code\n // 2) HTML comments <!-- ... -->\n // 3) other HTML tags like <b>, <div attr=\"x\">, etc.\n const re = /(```[\\s\\S]*?```|`[^`]*`)|(<!--[\\s\\S]*?-->)|(<[^>]+>)/g;\n\n return markdown.replace(re, (fullMatch: string, code?: string, comment?: string, tag?: string) => {\n if (code) return code;\n if (comment) return comment;\n if (!tag) return fullMatch;\n\n return tag.replace(/[&<>]/g, ch => escapeMap[ch]);\n });\n}\n\n/** Credits: https://github.com/chalk/ansi-regex */\nfunction ansiRegex({ onlyFirst = false } = {}) {\n // Valid string terminator sequences are BEL, ESC\\, and 0x9c\n const ST = String.raw`(?:\\u0007|\\u001B\\u005C|\\u009C)`;\n\n // OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n const osc = String.raw`(?:\\u001B\\][\\s\\S]*?${ST})`;\n\n // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n const csi = String.raw`[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`;\n\n const pattern = `${osc}|${csi}`;\n\n return new RegExp(pattern, onlyFirst ? undefined : \"g\");\n}\n\nconst regex = ansiRegex();\n\nexport function stripAnsi(string: string): string {\n return string.replace(regex, \"\");\n}\n\nexport function findDuplicateStrings(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const duplicates = new Set<string>();\n\n for (const value of values) {\n if (seen.has(value)) {\n duplicates.add(value);\n continue;\n }\n\n seen.add(value);\n }\n\n return Array.from(duplicates);\n}\n"],"mappings":"AAMO,SAASA,aAAaC,EAAoBC,GAC/C,MAAMC,EAAUF,EAAO,aAAaG,SAASF,GAC7C,GAAIC,aAAmBE,QACrB,MAAM,IAAIC,UAAU,yCAGtB,OAAOH,CACT,CAEO,SAASI,0BAA0BN,GACxC,MAAME,EAAUH,aAAaC,GAE7B,OAAIE,EAAQK,OACH,CAAEC,kBAAc,EAAWC,UAAU,GAGvC,CAAED,aAAcN,EAAQD,MAAOQ,UAAU,EAClD,CAEO,SAASC,YAAYV,EAAoBW,GAC9C,MAAMF,SAAEA,EAAAD,aAAUA,GAAiBF,0BAA0BN,GAE7D,MAAO,CACLA,SACAS,WACAD,eACAI,SAAUD,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CC,EAEEA,EAAIlD,QAAQ,SAAUmD,GAAML,EAAUK,IAF5BJ,IAIrB,CAGA,SAASK,WAAUC,UAAEA,GAAY,GAAU,CAAC,GAE1C,MAAMC,EAAKC,OAAOC,GAAA,iCAGZC,EAAMF,OAAOC,GAAA,sBAAyBF,KAGtCI,EAAMH,OAAOC,GAAA,+EAInB,OAAO,IAAIG,OAFK,GAAGF,KAAOC,IAECL,OAAY,EAAY,IACrD,CAEA,IAAMO,MAAQR,YAEP,SAASS,UAAUrC,GACxB,OAAOA,EAAOxB,QAAQ4D,MAAO,GAC/B,CAEO,SAASE,qBAAqBnE,GACnC,MAAMoE,EAAO,IAAIhD,IACXiD,EAAa,IAAIjD,IAEvB,UAAWrC,KAASiB,EACdoE,EAAKE,IAAIvF,GACXsF,EAAWE,IAAIxF,GAIjBqF,EAAKG,IAAIxF,GAGX,OAAOsC,MAAMC,KAAK+C,EACpB,Q","ignoreList":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Cli } from "../types/definitions-types.ts";
|
|
2
|
-
/**
|
|
3
|
-
* - Generates a PowerShell autocomplete script for your CLI.
|
|
4
|
-
* - The script assumes that your CLI is available as a `.ps1` file in the environment variable. For example:
|
|
5
|
-
* `cliName.ps1`.
|
|
6
|
-
* - This should return a path to your script: `(Get-Command <cliName>.ps1).Source`
|
|
7
|
-
* - The generated script should be added to your `profile.ps1` file:
|
|
8
|
-
*
|
|
9
|
-
* - Run: `notepad $profile`
|
|
10
|
-
* - Add the following line: `. "<generated script path>"`
|
|
11
|
-
* - Save and reopen powershell to take effect
|
|
12
|
-
*/
|
|
13
|
-
export declare function generatePowerShellAutocompleteScript(cliDefinition: Cli): string;
|
|
14
|
-
//# sourceMappingURL=powershell-autocomplete-script.d.ts.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Cli } from "../types/definitions-types.ts";
|
|
2
|
-
/**
|
|
3
|
-
* - Generates a ZSH autocomplete script for your CLI.
|
|
4
|
-
* - The generated script should be added to your `~/.zshrc` or `~/.zsh_profile` file:
|
|
5
|
-
*
|
|
6
|
-
* - Run: `nano $HOME/.zshrc` or `nano $HOME/.zsh_profile`
|
|
7
|
-
* - Add the following line: `source <generated script path>`
|
|
8
|
-
* - Save and reopen zsh to take effect
|
|
9
|
-
*/
|
|
10
|
-
export declare function generateZshAutocompleteScript(cliDefinition: Cli): string;
|
|
11
|
-
//# sourceMappingURL=zsh-autocomplete-script.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { CoerceMethod } from "../types/types.ts";
|
|
2
|
-
export declare const coerce: {
|
|
3
|
-
string: CoerceMethod<string>;
|
|
4
|
-
boolean: CoerceMethod<boolean>;
|
|
5
|
-
number: CoerceMethod<number>;
|
|
6
|
-
/** @param separator - The separator to use to split the string. **Default** is `","` */
|
|
7
|
-
stringArray: (separator: string) => CoerceMethod<string[]>;
|
|
8
|
-
/** @param separator - The separator to use to split the string. **Default** is `","` */
|
|
9
|
-
numberArray: (separator: string) => CoerceMethod<number[]>;
|
|
10
|
-
/** @param separator - The separator to use to split the string. **Default** is `","` */
|
|
11
|
-
booleanArray: (separator: string) => CoerceMethod<boolean[]>;
|
|
12
|
-
/** @param separator - The separator to use to split the string. **Default** is `","` */
|
|
13
|
-
stringSet: (separator: string) => CoerceMethod<Set<string>>;
|
|
14
|
-
/** @param separator - The separator to use to split the string. **Default** is `","` */
|
|
15
|
-
numberSet: (separator: string) => CoerceMethod<Set<number>>;
|
|
16
|
-
/** @param separator - The separator to use to split the string. **Default** is `","` */
|
|
17
|
-
booleanSet: (separator: string) => CoerceMethod<Set<boolean>>;
|
|
18
|
-
json: <T>(reviver?: (this: any, key: string, value: any) => any) => CoerceMethod<T>;
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=coerce-methods.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-methods.d.ts","sourceRoot":"","sources":["../../../src/coerce/coerce-methods.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAqDtD,eAAO,MAAM,MAAM;;;;IAIjB,wFAAwF;6BAxC1D,MAAM,KAAG,YAAY,CAAC,MAAM,EAAE,CAAC;IA0C7D,wFAAwF;6BApC1D,MAAM;IAsCpC,wFAAwF;8BAhCzD,MAAM;IAkCrC,wFAAwF;2BA5B5D,MAAM;IA8BlC,wFAAwF;2BAxB5D,MAAM;IA0BlC,wFAAwF;4BApB3D,MAAM;WApCvB,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,KAAG,YAAY,CAAC,CAAC,CAAC;CA2DvF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string-to-array.d.ts","sourceRoot":"","sources":["../../../src/coerce/string-to-array.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM,EAAE,CAK1F;AAED,wDAAwD;AACxD,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM,EAAE,CAE1F;AAED,yDAAyD;AACzD,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,OAAO,EAAE,CAE5F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string-to-primitive.d.ts","sourceRoot":"","sources":["../../../src/coerce/string-to-primitive.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAUvD;AAED,0BAA0B;AAC1B,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAgBrD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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AAQ,CAAC,GAAG;KAAG,YAAY,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,CAAC;CAAE,GAAG,CAAC,CAAC;AAG9G,KAAK,eAAe,CAAC,CAAC,SAAS,UAAU,IAAI;KAC1C,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,UAAU,GACtC,CAAC,SAAS,SAAS,GACjB,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAClB,CAAC,SAAS,WAAW,GACnB,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GACpB,CAAC,CAAC,CAAC,CAAC,GACR,KAAK;CACV,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,UAAU;yBAM/D,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;;EAyBpE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-cli-definition.d.ts","sourceRoot":"","sources":["../../../src/definitions/validate-cli-definition.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,GAAG,EAAc,MAAM,+BAA+B,CAAC;AAErE,2CAA2C;AAC3C,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,GAAG,QAwEvD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"object-context-builder.d.ts","sourceRoot":"","sources":["../../../../src/parse/context/object-context-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAY,GAAG,EAAU,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,sBAAsB;AACtB,wBAAgB,kBAAkB,CAAC,W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,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { Cli, Subcommand } from "./definitions-types.ts";
|
|
2
|
-
import type { PrintHelpOptions } from "./help-message-types.ts";
|
|
3
|
-
import type { InferInputType, InputTypeWide, OutputType, OutputTypeWide } from "./io-types.ts";
|
|
4
|
-
type PrimitiveTypeNames = "string" | "number" | "boolean" | "object" | "unknown";
|
|
5
|
-
export type CoerceTypes = PrimitiveTypeNames | `${PrimitiveTypeNames}[]` | `set<${PrimitiveTypeNames}>` | (string & {});
|
|
6
|
-
export interface CoerceMethod<Value> {
|
|
7
|
-
(terminalInput: string): Value;
|
|
8
|
-
type?: CoerceTypes;
|
|
9
|
-
}
|
|
10
|
-
type GetSubcommandsNames<T extends Partial<Subcommand>> = T extends Cli ? T["subcommands"] extends infer S extends readonly [Subcommand, ...Subcommand[]] ? {
|
|
11
|
-
[Index in keyof S]: S[Index] extends {
|
|
12
|
-
name: string;
|
|
13
|
-
} ? S[Index]["name"] : never;
|
|
14
|
-
}[number] : never : never;
|
|
15
|
-
type Unsubscribe = () => void;
|
|
16
|
-
export interface AttachedMethods<T extends Cli | Subcommand> {
|
|
17
|
-
/**
|
|
18
|
-
* Add a handler to be called when the subcommand/cli is executed.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const unsubscribe = cli.onExecute(result => console.log(result));
|
|
22
|
-
*/
|
|
23
|
-
onExecute: (handler: (data: OutputType<[T]>) => void) => Unsubscribe;
|
|
24
|
-
execute: InferInputType<T> extends infer InputType ? undefined extends InputType ? (input?: InputType) => void : (input: InputType) => void : never;
|
|
25
|
-
/** **WARNING**: This will only be available after the CLI schema has been created */
|
|
26
|
-
generateCliHelpMessage?: (options?: PrintHelpOptions) => string;
|
|
27
|
-
/**
|
|
28
|
-
* **WARNING**: This will only be available after the CLI schema has been created
|
|
29
|
-
*
|
|
30
|
-
* @throws {Error} - When the subcommand is not found
|
|
31
|
-
*/
|
|
32
|
-
generateSubcommandHelpMessage?: (subcommandName: GetSubcommandsNames<T> | (string & {}), options?: PrintHelpOptions) => string;
|
|
33
|
-
}
|
|
34
|
-
export interface AttachedMethodsWide {
|
|
35
|
-
onExecute: (handler: (data: OutputTypeWide) => void) => Unsubscribe;
|
|
36
|
-
execute: (input?: InputTypeWide) => void;
|
|
37
|
-
generateCliHelpMessage?: (options?: PrintHelpOptions) => void;
|
|
38
|
-
/** @throws {Error} - When the subcommand is not found */
|
|
39
|
-
generateSubcommandHelpMessage?: (subcommandName: string, options?: PrintHelpOptions) => void;
|
|
40
|
-
}
|
|
41
|
-
export type CliOutputType<S extends Cli> = OutputType<[S]> | (S["subcommands"] extends readonly [Subcommand, ...Subcommand[]] ? OutputType<S["subcommands"]> : never);
|
|
42
|
-
export type CliParseResult<S extends Cli> = {
|
|
43
|
-
value: CliOutputType<S>;
|
|
44
|
-
error?: undefined;
|
|
45
|
-
} | {
|
|
46
|
-
value?: never;
|
|
47
|
-
error: Error;
|
|
48
|
-
};
|
|
49
|
-
export type CliParseResultWide = {
|
|
50
|
-
value: OutputTypeWide;
|
|
51
|
-
error?: undefined;
|
|
52
|
-
} | {
|
|
53
|
-
value?: never;
|
|
54
|
-
error: Error;
|
|
55
|
-
};
|
|
56
|
-
export interface ValidateMethods<S extends Cli> {
|
|
57
|
-
run(input: string | string[]): CliParseResult<S>;
|
|
58
|
-
runAsync(input: string | string[]): Promise<CliParseResult<S>>;
|
|
59
|
-
}
|
|
60
|
-
export {};
|
|
61
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,c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AM,GAAG,MAAM,CAEjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA2B3D;AAED,eAAe;AACf,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,UAE/B;AAED,YAAY;AACZ,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,UAGnC;AAED,wGAAwG;AACxG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAcrD;AAED,+CAA+C;AAC/C,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAIpE;AAED,2CAA2C;AAC3C,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAwB1E;AAED,uDAAuD;AACvD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA4EjD;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAgBvD;AAoBD,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAcxE"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|