diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d83e6ab..f2c7f2b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,3 +59,9 @@ jobs: - name: Run smoke tests run: pnpm exec mocha --forbid-only "test/smoke/**/*.test.ts" + + - name: Install completion test shells + run: sudo apt-get update && sudo apt-get install -y fish zsh + + - name: Test npm package installation + run: pnpm run test:package diff --git a/.mocharc.json b/.mocharc.json index 4a09d14..c33f5de 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -1,4 +1,5 @@ { + "node-option": ["no-experimental-strip-types"], "require": [ "test/helpers/init.js", "ts-node/register" diff --git a/README.md b/README.md index 04aa67e..195dfd7 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ $ npm install -g @hackmd/hackmd-cli $ hackmd-cli COMMAND running command... $ hackmd-cli (--version|-v) -@hackmd/hackmd-cli/2.5.1 darwin-arm64 node-v26.0.0 +@hackmd/hackmd-cli/2.5.1 darwin-arm64 node-v24.22.0 $ hackmd-cli --help [COMMAND] USAGE $ hackmd-cli COMMAND @@ -39,6 +39,12 @@ USAGE ``` +### Shell completion + +Run `hackmd-cli autocomplete bash`, `hackmd-cli autocomplete zsh`, or `hackmd-cli autocomplete fish` and follow the printed setup instructions. + +Fish completion is generated in the CLI cache. Its setup instructions copy the generated file into your user completion directory; no system directory or `pkg-config` is required. Run the setup again after upgrading the CLI. + ## Configuration ### Set access token @@ -51,7 +57,7 @@ Set the access token by `login` command. By doing so, the access token will be s ```sh-session $ hackmd-cli login -Enter your access token: My_ACCESS_TOKEN +Enter your access token: [hidden] ``` Or you don't want to keep the credentials in one file, you can set it through environment variable: @@ -107,7 +113,7 @@ All available configurations are listed in the table below. * [`hackmd-cli folders delete`](#hackmd-cli-folders-delete) * [`hackmd-cli folders order`](#hackmd-cli-folders-order) * [`hackmd-cli folders update`](#hackmd-cli-folders-update) -* [`hackmd-cli help [COMMANDS]`](#hackmd-cli-help-commands) +* [`hackmd-cli help [COMMAND]`](#hackmd-cli-help-command) * [`hackmd-cli history`](#hackmd-cli-history) * [`hackmd-cli login`](#hackmd-cli-login) * [`hackmd-cli logout`](#hackmd-cli-logout) @@ -130,20 +136,20 @@ All available configurations are listed in the table below. ## `hackmd-cli autocomplete [SHELL]` -display autocomplete installation instructions +Display autocomplete installation instructions ``` USAGE $ hackmd-cli autocomplete [SHELL] [-r] ARGUMENTS - SHELL shell type + [SHELL] (bash|fish|zsh|powershell) Shell type FLAGS -r, --refresh-cache Refresh cache (ignores displaying instructions) DESCRIPTION - display autocomplete installation instructions + Display autocomplete installation instructions EXAMPLES $ hackmd-cli autocomplete @@ -157,7 +163,7 @@ EXAMPLES $ hackmd-cli autocomplete --refresh-cache ``` -_See code: [@hackmd/oclif-plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v2.1.9-fish/src/commands/autocomplete/index.ts)_ +_See code: [src/commands/autocomplete/index.ts](https://github.com/hackmdio/hackmd-cli/blob/v2.5.1/src/commands/autocomplete/index.ts)_ ## `hackmd-cli export` @@ -168,8 +174,8 @@ USAGE $ hackmd-cli export [-h] [--noteId ] FLAGS - -h, --help Show CLI help. - --noteId= HackMD note id + -h, --help Show CLI help. + --noteId= HackMD note id DESCRIPTION Export note content @@ -187,21 +193,21 @@ HackMD folders commands ``` USAGE - $ hackmd-cli folders [--folderId ] [-h] [--columns | -x] [--sort ] [--filter ] - [--output csv|json|yaml | | [--csv | --no-truncate]] [--no-header | ] + $ hackmd-cli folders [--folderId ] [-h] [--columns | -x] [--filter ] [--no-header | + [--csv | --no-truncate]] [--output csv|json|yaml | | ] [--sort ] FLAGS - -h, --help Show CLI help. - -x, --extended show extra columns - --columns= only show provided columns (comma-separated) - --csv output is csv format [alias: --output=csv] - --filter= filter property by partial string matching, ex: name=foo - --folderId= HackMD folder id - --no-header hide table header from output - --no-truncate do not truncate output to fit screen - --output=