pax_global_header00006660000000000000000000000064151415445510014517gustar00rootroot0000000000000052 comment=a58b42f39e2fb04b28b8169005a5ddbc3302730e isaacs-jackspeak-223a155/000077500000000000000000000000001514154455100151605ustar00rootroot00000000000000isaacs-jackspeak-223a155/.github/000077500000000000000000000000001514154455100165205ustar00rootroot00000000000000isaacs-jackspeak-223a155/.github/workflows/000077500000000000000000000000001514154455100205555ustar00rootroot00000000000000isaacs-jackspeak-223a155/.github/workflows/ci.yml000066400000000000000000000014671514154455100217030ustar00rootroot00000000000000name: CI on: [push, pull_request] jobs: build: strategy: matrix: node-version: [20.x, 22.x] platform: - os: ubuntu-latest shell: bash - os: macos-latest shell: bash - os: windows-latest shell: bash - os: windows-latest shell: powershell fail-fast: false runs-on: ${{ matrix.platform.os }} defaults: run: shell: ${{ matrix.platform.shell }} steps: - name: Checkout Repository uses: actions/checkout@v3 - name: Use Nodejs ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - name: Install dependencies run: npm install - name: Run Tests run: npm test -- -c -t0 isaacs-jackspeak-223a155/.github/workflows/typedoc.yml000066400000000000000000000024131514154455100227470ustar00rootroot00000000000000# Simple workflow for deploying static content to GitHub Pages name: Deploy static content to Pages on: # Runs on pushes targeting the default branch push: branches: ["main"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write # Allow one concurrent deployment concurrency: group: "pages" cancel-in-progress: true jobs: # Single deploy job since we're just deploying deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Use Nodejs ${{ matrix.node-version }} uses: actions/setup-node@v3 with: node-version: 18.x - name: Install dependencies run: npm install - name: Generate typedocs run: npm run typedoc - name: Setup Pages uses: actions/configure-pages@v3 - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: './docs' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 isaacs-jackspeak-223a155/.gitignore000066400000000000000000000004161514154455100171510ustar00rootroot00000000000000/* /.* !/.prettierignore !/examples !typedoc.json !tsconfig*.json !.github !src/ !bin/ !lib/ !package.json !package-lock.json !README.md !CONTRIBUTING.md !LICENSE.md !CHANGELOG.md !example/ !scripts/ !tap-snapshots/ !test/ !.gitignore !.gitattributes !map.js !/build.sh isaacs-jackspeak-223a155/.prettierignore000066400000000000000000000002531514154455100202230ustar00rootroot00000000000000/node_modules /example /.github /dist .env /tap-snapshots /.nyc_output /coverage /benchmark /scripts/fixture /test/fixture /examples/*.d.ts /examples/*.map /examples/*.js isaacs-jackspeak-223a155/LICENSE.md000066400000000000000000000030161514154455100165640ustar00rootroot00000000000000# Blue Oak Model License Version 1.0.0 ## Purpose This license gives everyone as much permission to work with this software as possible, while protecting contributors from liability. ## Acceptance In order to receive this license, you must agree to its rules. The rules of this license are both obligations under that agreement and conditions to your license. You must not do anything with this software that triggers a rule that you cannot or will not follow. ## Copyright Each contributor licenses you to do everything with this software that would otherwise infringe that contributor's copyright in it. ## Notices You must ensure that everyone who gets a copy of any part of this software from you, with or without changes, also gets the text of this license or a link to . ## Excuse If anyone notifies you in writing that you have not complied with [Notices](#notices), you can keep your license by taking all practical steps to comply within 30 days after the notice. If you do not do so, your license ends immediately. ## Patent Each contributor licenses you to do everything with this software that would otherwise infringe any patent claims they can license or become able to license. ## Reliability No contributor can revoke this license. ## No Liability **_As far as the law allows, this software comes as is, without any warranty or condition, and no contributor will be liable to anyone for any damages related to this software or this license, under any kind of legal claim._** isaacs-jackspeak-223a155/README.md000066400000000000000000000304621514154455100164440ustar00rootroot00000000000000# jackspeak A very strict and proper argument parser. Validate string, boolean, and number options, from the command line and the environment. Call the `jack` method with a config object, and then chain methods off of it. At the end, call the `.parse()` method, and you'll get an object with `positionals` and `values` members. Any unrecognized configs or invalid values will throw an error. As long as you define configs using object literals, types will be properly inferred and TypeScript will know what kinds of things you got. If you give it a prefix for environment variables, then defaults will be read from the environment, and parsed values written back to it, so you can easily pass configs through to child processes. Automatically generates a `usage`/`help` banner by calling the `.usage()` method. Unless otherwise noted, all methods return the object itself. ## USAGE ```js // the minified version has no external deps, typically better // startup time for CLI tools that would use jackspeak. import { jack } from 'jackspeak/min' // this works too: // const { jack } = require('jackspeak/min') const { positionals, values } = jack({ envPrefix: 'FOO' }) .flag({ asdf: { description: 'sets the asfd flag', short: 'a', default: true }, 'no-asdf': { description: 'unsets the asdf flag', short: 'A' }, foo: { description: 'another boolean', short: 'f' }, }) .optList({ 'ip-addrs': { description: 'addresses to ip things', delim: ',', // defaults to '\n' default: ['127.0.0.1'], }, }) .parse([ 'some', 'positional', '--ip-addrs', '192.168.0.1', '--ip-addrs', '1.1.1.1', 'args', '--foo', // sets the foo flag '-A', // short for --no-asdf, sets asdf flag to false ]) console.log(process.env.FOO_ASDF) // '0' console.log(process.env.FOO_FOO) // '1' console.log(values) // { // 'ip-addrs': ['192.168.0.1', '1.1.1.1'], // foo: true, // asdf: false, // } console.log(process.env.FOO_IP_ADDRS) // '192.168.0.1,1.1.1.1' console.log(positionals) // ['some', 'positional', 'args'] ``` ## `jack(options: JackOptions = {}) => Jack` Returns a `Jack` object that can be used to chain and add field definitions. The other methods (apart from `validate()`, `parse()`, and `usage()` obviously) return the same Jack object, updated with the new types, so they can be chained together as shown in the code examples. Options: - `allowPositionals` Defaults to true. Set to `false` to not allow any positional arguments. - `envPrefix` Set to a string to write configs to and read configs from the environment. For example, if set to `MY_APP` then the `foo-bar` config will default based on the value of `env.MY_APP_FOO_BAR` and will write back to that when parsed. Boolean values are written as `'1'` and `'0'`, and will be treated as `true` if they're `'1'` or false otherwise. Number values are written with their `toString()` representation. Strings are just strings. Any value with `multiple: true` will be represented in the environment split by a delimiter, which defaults to `\n`. - `env` The place to read/write environment variables. Defaults to `process.env`. - `usage` A short usage string to print at the top of the help banner. - `stopAtPositional` Boolean, default false. Stop parsing opts and flags at the first positional argument. This is useful if you want to pass certain options to subcommands, like some programs do, so you can stop parsing and pass the positionals to the subcommand to parse. - `stopAtPositionalTest` Conditional `stopAtPositional`. Provide a function that takes a positional argument string and returns boolean. If it returns `true`, then parsing will stop. Useful when _some_ subcommands should parse the rest of the command line options, and others should not. ### `Jack.heading(text: string, level?: 1 | 2 | 3 | 4 | 5 | 6)` Define a short string heading, used in the `usage()` output. Indentation of the heading and subsequent description/config usage entries (up until the next heading) is set by the heading level. If the first usage item defined is a heading, it is always treated as level 1, regardless of the argument provided. Headings level 1 and 2 will have a line of padding underneath them. Headings level 3 through 6 will not. ### `Jack.description(text: string, { pre?: boolean } = {})` Define a long string description, used in the `usage()` output. If the `pre` option is set to `true`, then whitespace will not be normalized. However, if any line is too long for the width allotted, it will still be wrapped. ## Option Definitions Configs are defined by calling the appropriate field definition method with an object where the keys are the long option name, and the value defines the config. Options: - `type` Only needed for the `addFields` method, as the others set it implicitly. Can be `'string'`, `'boolean'`, or `'number'`. - `multiple` Only needed for the `addFields` method, as the others set it implicitly. Set to `true` to define an array type. This means that it can be set on the CLI multiple times, set as an array in the `values` and it is represented in the environment as a delimited string. - `short` A one-character shorthand for the option. - `description` Some words to describe what this option is and why you'd set it. - `hint` (Only relevant for non-boolean types) The thing to show in the usage output, like `--option=` - `validate` A function that returns false (or throws) if an option value is invalid. - `validOptions` An array of strings or numbers that define the valid values that can be set. This is not allowed on `boolean` (flag) options. May be used along with a `validate()` method. - `default` A default value for the field. Note that this may be overridden by an environment variable, if present. ### `Jack.flag({ [option: string]: definition, ... })` Define one or more boolean fields. Boolean options may be set to `false` by using a `--no-${optionName}` argument, which will be implicitly created if it's not defined to be something else. If a boolean option named `no-${optionName}` with the same `multiple` setting is in the configuration, then that will be treated as a negating flag. ### `Jack.flagList({ [option: string]: definition, ... })` Define one or more boolean array fields. ### `Jack.num({ [option: string]: definition, ... })` Define one or more number fields. These will be set in the environment as a stringified number, and included in the `values` object as a number. ### `Jack.numList({ [option: string]: definition, ... })` Define one or more number list fields. These will be set in the environment as a delimited set of stringified numbers, and included in the `values` as a number array. ### `Jack.opt({ [option: string]: definition, ... })` Define one or more string option fields. ### `Jack.optList({ [option: string]: definition, ... })` Define one or more string list fields. ### `Jack.addFields({ [option: string]: definition, ... })` Define one or more fields of any type. Note that `type` and `multiple` must be set explicitly on each definition when using this method. ## Informative Getters Once you've defined several fields with the various methods described above, you can get at the definitions and such with these methods. This are primarily just informative, but can be useful in some advanced scenarios, such as providing "Did you mean?" type suggestions when someone misspells an option name. ### `Jack.definitions` The set of config field definitions in no particular order. This is a data object suitable to passing to `util.parseArgs`, but with the addition of `short` and `description` fields, where appropriate. ### `Jack.jackOptions` The options passed into the initial `jack()` function (or `new Jack()` constructor). ### `Jack.shorts` The `{ : }` name record for all short options defined. ### `Jack.usageFields` The array of fields that are used to generate `Jack.usage()` and `Jack.usageMarkdown()` content. ## Actions Use these methods on a Jack object that's already had its config fields defined. ### `Jack.parse(args: string[] = process.argv): { positionals: string[], values: OptionsResults }` Parse the arguments list, write to the environment if `envPrefix` is set, and returned the parsed values and remaining positional arguments. ### `Jack.validate(o: unknown): asserts o is OptionsResults` Throws an error if the object provided is not a valid result set, for the configurations defined thusfar. ### `Jack.usage(): string` Returns the compiled `usage` string, with all option descriptions and heading/description text, wrapped to the appropriate width for the terminal. ### `Jack.setConfigValues(options: OptionsResults, src?: string)` Validate the `options` argument, and set the default value for each field that appears in the options. Values provided will be overridden by environment variables or command line arguments. ### `Jack.usageMarkdown(): string` Returns the compiled `usage` string, with all option descriptions and heading/description text, but as markdown instead of formatted for a terminal, for generating HTML documentation for your CLI. ## Some Example Code Also see [the examples folder](https://github.com/isaacs/jackspeak/tree/master/examples) ```js // the minified version has no external deps, typically better // startup time for CLI tools that would use jackspeak. // but `import { jack } from 'jackspeak'` also works fine. import { jack } from 'jackspeak/min' const j = jack({ // Optional // This will be auto-generated from the descriptions if not supplied // top level usage line, printed by -h // will be auto-generated if not specified usage: 'foo [options] ', }) .heading('The best Foo that ever Fooed') .description( ` Executes all the files and interprets their output as TAP formatted test result data. To parse TAP data from stdin, specify "-" as a filename. `, ) // flags don't take a value, they're boolean on or off, and can be // turned off by prefixing with `--no-` // so this adds support for -b to mean --bail, or -B to mean --no-bail .flag({ flag: { // specify a short value if you like. this must be a single char short: 'f', // description is optional as well. description: `Make the flags wave`, // default value for flags is 'false', unless you change it default: true, }, 'no-flag': { // you can can always negate a flag with `--no-flag` // specifying a negate option will let you define a short // single-char option for negation. short: 'F', description: `Do not wave the flags`, }, }) // Options that take a value are specified with `opt()` .opt({ reporter: { short: 'R', description: 'the style of report to display', }, }) // if you want a number, say so, and jackspeak will enforce it .num({ jobs: { short: 'j', description: 'how many jobs to run in parallel', default: 1, }, }) // A list is an option that can be specified multiple times, // to expand into an array of all the settings. Normal opts // will just give you the last value specified. .optList({ 'node-arg': {}, }) // a flagList is an array of booleans, so `-ddd` is [true, true, true] // count the `true` values to treat it as a counter. .flagList({ debug: { short: 'd' }, }) // opts take a value, and is set to the string in the results // you can combine multiple short-form flags together, but // an opt will end the combine chain, posix-style. So, // -bofilename would be like --bail --output-file=filename .opt({ 'output-file': { short: 'o', // optional: make it -o in the help output insead of -o hint: 'file', description: `Send the raw output to the specified file.`, }, }) // now we can parse argv like this: const { values, positionals } = j.parse(process.argv) // or decide to show the usage banner console.log(j.usage()) // or validate an object config we got from somewhere else try { j.validate(someConfig) } catch (er) { console.error('someConfig is not valid!', er) } ``` ## Name The inspiration for this module is [yargs](http://npm.im/yargs), which is pirate talk themed. Yargs has all the features, and is infinitely flexible. "Jackspeak" is the slang of the royal navy. This module does not have all the features. It is declarative and rigid by design. isaacs-jackspeak-223a155/build.sh000066400000000000000000000005421514154455100166140ustar00rootroot00000000000000#!/usr/bin/env bash esbuild --minify \ --sourcemap \ --platform=node \ --tree-shaking=true \ --bundle dist/commonjs/index.js \ --outfile=dist/commonjs/index.min.js \ --format=cjs esbuild --minify \ --sourcemap \ --platform=node \ --tree-shaking=true \ --bundle dist/esm/index.js \ --outfile=dist/esm/index.min.js \ --format=esm isaacs-jackspeak-223a155/changelog.md000066400000000000000000000025221514154455100174320ustar00rootroot00000000000000# 4.2 - ship a `jackspeak/min` package export path for faster loading # 4.1 - capture stack trace nicely on file loading errors (2025-05-22) - expose definitions, usageFields, jackOptions, shorts (2025-02-22) # 4.0 - Require modern node versions # 3.4 - abstract out post-parse actions, slice process.argv in parseRaw # 3.3 - Add `stopAtPositionalTest` method # 3.2 - still validate if stopAtPositional is set - add parseRaw() method, to parse without side effects - improve fenced code sections in usage output - add hint to toJSON output # 3.1 - Add `validOptions` config option, to specify a discrete set of acceptable values. - `validate` methods now take an `unknown` argument, which is more appropriate than `any` as it encourages more deliberate type assertions. # 3.0 - Move custom `Error` fields to the `cause` property where they belong. # 2.3 - add `jack.usageMarkdown()` method # 2.2 - add support for {pre:true} on description fields - add heading level support # 2.1 - Add `jack.setConfigValues()` method # 2.0 - Complete rewrite as hybrid TypeScript module # 1.1 - Cosmetic changes to help output - `implies` support - `valid` option value lists # 1.0 Multi-section parsing, environment variables # 0.1 Automatic `--help` usage output handling # 0.0 Basic functionality. No help or usage output support yet. isaacs-jackspeak-223a155/examples/000077500000000000000000000000001514154455100167765ustar00rootroot00000000000000isaacs-jackspeak-223a155/examples/git-tag.d.ts000066400000000000000000000000601514154455100211200ustar00rootroot00000000000000export {}; //# sourceMappingURL=git-tag.d.ts.mapisaacs-jackspeak-223a155/examples/git-tag.d.ts.map000066400000000000000000000001451514154455100217000ustar00rootroot00000000000000{"version":3,"file":"git-tag.d.ts","sourceRoot":"","sources":["git-tag.ts"],"names":[],"mappings":""}isaacs-jackspeak-223a155/examples/git-tag.js000066400000000000000000000055471514154455100207030ustar00rootroot00000000000000import('../dist/esm/index.js').then(({ jack }) => { const j = jack({ usage: ` git tag [-a | -s | -u ] [-f] [-m | -F ] [-e] [ | ] or: git tag -d ... or: git tag [-n[]] -l [--contains ] [--no-contains ] [--points-at ] [--column[=] | --no-column] [--create-reflog] [--sort=] [--format=] [--merged ] [--no-merged ] [...] or: git tag -v [--format=] ... `, }) .flag({ list: { short: 'l', description: 'list tag names', }, }) .opt({ n: { hint: 'n', description: 'print lines of each tag message', }, }) .flag({ delete: { short: 'd', description: 'delete tags', }, }) .flag({ verify: { short: 'v', description: 'verify tags', negate: { hidden: true }, }, }) .flag({ help: { short: 'h', }, }) .description('Tag creation options') .flag({ annotate: { short: 'a', description: 'annotated tag, needs a message', }, }) .opt({ message: { short: 'm', hint: 'message', description: 'tag message', }, file: { short: 'F', hint: 'file', description: 'read message from file', }, }) .flag({ sign: { short: 's', description: 'annotated and GPG-signed tag', }, }) .opt({ cleanup: { hint: 'mode', description: 'how to strip spaces and #comments from message', }, 'local-user': { short: 'u', hint: 'key-id', description: 'use another key to sign the tag', }, }) .flag({ force: { short: 'f', description: 'replace the tag if exists', }, }) .description('Tag listing options') .opt({ column: { hint: 'style', description: 'show tag list in columns', }, sort: { hint: 'type', description: 'sort tags', }, contains: { hint: 'commit', description: 'print only tags that contain the commit', }, 'points-at': { hint: 'object', description: 'print only tags of the object', }, }); const { values, positionals } = j.parse(); if (values.help) console.log(j.usage()); else console.log({ values, positionals }); }); export {}; //# sourceMappingURL=git-tag.js.mapisaacs-jackspeak-223a155/examples/git-tag.js.map000066400000000000000000000107621514154455100214520ustar00rootroot00000000000000{"version":3,"file":"git-tag.js","sourceRoot":"","sources":["git-tag.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC/C,MAAM,CAAC,GAAG,IAAI,CAAC;QACb,KAAK,EAAE;;;;;;;;;KASN;KACF,CAAC;SACC,IAAI,CAAC;QACJ,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,gBAAgB;SAC9B;KACF,CAAC;SACD,GAAG,CAAC;QACH,CAAC,EAAE;YACD,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,qCAAqC;SACnD;KACF,CAAC;SACD,IAAI,CAAC;QACJ,MAAM,EAAE;YACN,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,aAAa;SAC3B;KACF,CAAC;SACD,IAAI,CAAC;QACJ,MAAM,EAAE;YACN,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,aAAa;YAC1B,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACzB;KACF,CAAC;SACD,IAAI,CAAC;QACJ,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;SACX;KACF,CAAC;SACD,WAAW,CAAC,sBAAsB,CAAC;SACnC,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,gCAAgC;SAC9C;KACF,CAAC;SACD,GAAG,CAAC;QACH,OAAO,EAAE;YACP,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,aAAa;SAC3B;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,wBAAwB;SACtC;KACF,CAAC;SACD,IAAI,CAAC;QACJ,IAAI,EAAE;YACJ,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,8BAA8B;SAC5C;KACF,CAAC;SACD,GAAG,CAAC;QACH,OAAO,EAAE;YACP,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,gDAAgD;SAC9D;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,GAAG;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,iCAAiC;SAC/C;KACF,CAAC;SACD,IAAI,CAAC;QACJ,KAAK,EAAE;YACL,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,2BAA2B;SACzC;KACF,CAAC;SACD,WAAW,CAAC,qBAAqB,CAAC;SAClC,GAAG,CAAC;QACH,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,0BAA0B;SACxC;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,WAAW;SACzB;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,yCAAyC;SACvD;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,+BAA+B;SAC7C;KACF,CAAC,CAAA;IACJ,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAA;IACzC,IAAI,MAAM,CAAC,IAAI;QAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;;QAClC,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAA;AAC3C,CAAC,CAAC,CAAA","sourcesContent":["import('../dist/esm/index.js').then(({ jack }) => {\n const j = jack({\n usage: `\ngit tag [-a | -s | -u ] [-f] [-m | -F ] [-e]\n [ | ]\n or: git tag -d ...\n or: git tag [-n[]] -l [--contains ] [--no-contains ]\n [--points-at ] [--column[=] | --no-column]\n [--create-reflog] [--sort=] [--format=]\n [--merged ] [--no-merged ] [...]\n or: git tag -v [--format=] ...\n `,\n })\n .flag({\n list: {\n short: 'l',\n description: 'list tag names',\n },\n })\n .opt({\n n: {\n hint: 'n',\n description: 'print lines of each tag message',\n },\n })\n .flag({\n delete: {\n short: 'd',\n description: 'delete tags',\n },\n })\n .flag({\n verify: {\n short: 'v',\n description: 'verify tags',\n negate: { hidden: true },\n },\n })\n .flag({\n help: {\n short: 'h',\n },\n })\n .description('Tag creation options')\n .flag({\n annotate: {\n short: 'a',\n description: 'annotated tag, needs a message',\n },\n })\n .opt({\n message: {\n short: 'm',\n hint: 'message',\n description: 'tag message',\n },\n file: {\n short: 'F',\n hint: 'file',\n description: 'read message from file',\n },\n })\n .flag({\n sign: {\n short: 's',\n description: 'annotated and GPG-signed tag',\n },\n })\n .opt({\n cleanup: {\n hint: 'mode',\n description: 'how to strip spaces and #comments from message',\n },\n 'local-user': {\n short: 'u',\n hint: 'key-id',\n description: 'use another key to sign the tag',\n },\n })\n .flag({\n force: {\n short: 'f',\n description: 'replace the tag if exists',\n },\n })\n .description('Tag listing options')\n .opt({\n column: {\n hint: 'style',\n description: 'show tag list in columns',\n },\n sort: {\n hint: 'type',\n description: 'sort tags',\n },\n contains: {\n hint: 'commit',\n description: 'print only tags that contain the commit',\n },\n 'points-at': {\n hint: 'object',\n description: 'print only tags of the object',\n },\n })\n const { values, positionals } = j.parse()\n if (values.help) console.log(j.usage())\n else console.log({ values, positionals })\n})\n"]}isaacs-jackspeak-223a155/examples/git-tag.ts000066400000000000000000000050261514154455100207050ustar00rootroot00000000000000import('../dist/esm/index.js').then(({ jack }) => { const j = jack({ usage: ` git tag [-a | -s | -u ] [-f] [-m | -F ] [-e] [ | ] or: git tag -d ... or: git tag [-n[]] -l [--contains ] [--no-contains ] [--points-at ] [--column[=] | --no-column] [--create-reflog] [--sort=] [--format=] [--merged ] [--no-merged ] [...] or: git tag -v [--format=] ... `, }) .flag({ list: { short: 'l', description: 'list tag names', }, }) .opt({ n: { hint: 'n', description: 'print lines of each tag message', }, }) .flag({ delete: { short: 'd', description: 'delete tags', }, }) .flag({ verify: { short: 'v', description: 'verify tags', negate: { hidden: true }, }, }) .flag({ help: { short: 'h', }, }) .description('Tag creation options') .flag({ annotate: { short: 'a', description: 'annotated tag, needs a message', }, }) .opt({ message: { short: 'm', hint: 'message', description: 'tag message', }, file: { short: 'F', hint: 'file', description: 'read message from file', }, }) .flag({ sign: { short: 's', description: 'annotated and GPG-signed tag', }, }) .opt({ cleanup: { hint: 'mode', description: 'how to strip spaces and #comments from message', }, 'local-user': { short: 'u', hint: 'key-id', description: 'use another key to sign the tag', }, }) .flag({ force: { short: 'f', description: 'replace the tag if exists', }, }) .description('Tag listing options') .opt({ column: { hint: 'style', description: 'show tag list in columns', }, sort: { hint: 'type', description: 'sort tags', }, contains: { hint: 'commit', description: 'print only tags that contain the commit', }, 'points-at': { hint: 'object', description: 'print only tags of the object', }, }) const { values, positionals } = j.parse() if (values.help) console.log(j.usage()) else console.log({ values, positionals }) }) isaacs-jackspeak-223a155/examples/git-tag.txt000066400000000000000000000024751514154455100211030ustar00rootroot00000000000000Usage: git tag [-a | -s | -u ] [-f] [-m | -F ] [-e] [ | ] or: git tag -d ... or: git tag [-n[]] -l [--contains ] [--no-contains ] [--points-at ] [--column[=] | --no-column] [--create-reflog] [--sort=] [--format=] [--merged ] [--no-merged ] [...] or: git tag -v [--format=] ... -l --list list tag names --n= print lines of each tag message -d --delete delete tags -v --verify verify tags -h --help Tag creation options -a --annotate annotated tag, needs a message -m --message= tag message -F --file= read message from file -s --sign annotated and GPG-signed tag --cleanup= how to strip spaces and #comments from message -u --local-user= use another key to sign the tag -f --force replace the tag if exists Tag listing options --column=