From f5bbf5f4230506cb552c9f00eb309d0c408d4a3a Mon Sep 17 00:00:00 2001 From: Danny Ben Shitrit Date: Wed, 1 Jul 2026 14:41:03 +0300 Subject: [PATCH 1/3] update completions related pages --- src/advanced/bash-completion.md | 32 +++++++++++++++++++++----------- src/configuration/argument.md | 12 ++++++++++++ src/configuration/command.md | 5 +++++ src/configuration/flag.md | 4 ++-- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/src/advanced/bash-completion.md b/src/advanced/bash-completion.md index 9a0cecd..89975d1 100644 --- a/src/advanced/bash-completion.md +++ b/src/advanced/bash-completion.md @@ -37,29 +37,39 @@ By running `bashly generate --upgrade`, your completions function (generated with `bashly add completions`) will be regenerated. !!! -## Custom command completions +## Custom argument completions In addition to the automatic suggestion of subcommands and flags, you can instruct bashly to also suggest files, directories, users, git branches and -more. To do this, add another option in your `bashly.yml` on the command you -wish to alter: +more. + +For positional arguments, add `completions` to the argument that should receive +these suggestions: ```yaml bashly.yml commands: - name: upload help: Upload a file - completions: - - - - - - $(git branch 2> /dev/null) + args: + - name: source + help: File to upload + required: true + completions: + - + - + - $(git branch 2> /dev/null) ``` +The `completions` option is still supported on commands as a fallback for +positional arguments, but it is discouraged for new configurations. Prefer +placing completions directly on the relevant `args` entry. + ## Custom flag completions -The `completions` option is also available on flags that have an `arg`. -Similarly to the `allowed` option for arguments, the allowed list is added -to the suggestions automatically (without the need to use `completions`). +For flag values, add `completions` to flags that have an `arg`. Similarly to +the `allowed` option for arguments and flags, the allowed list is added to the +suggestions automatically (without the need to use `completions`). ```yaml bashly.yml commands: @@ -78,7 +88,7 @@ commands: ``` - Anything between `<...>` will be added using the `compgen -A action` flag. -- Anything else, will be appended to the `compgen -W` flag. +- Anything else will be appended to the `compgen -W` flag. !!! Note In case you are using the diff --git a/src/configuration/argument.md b/src/configuration/argument.md index a89592c..660a2b5 100644 --- a/src/configuration/argument.md +++ b/src/configuration/argument.md @@ -94,9 +94,21 @@ define required arguments after it. Limit the allowed values to a specified whitelist. Can be used in conjunction with [`default`](#default) or [`required`](#required). +Allowed values are also added to generated bash completions automatically. + [!button variant="primary" icon="code-review" text="Whitelist Example"](https://github.com/bashly-framework/bashly/tree/master/examples/whitelist#readme) +### completions + +[!badge Array of Strings] + +Specify an array of additional completion suggestions when used in conjunction +with `bashly add completions`. + +[!ref](/advanced/bash-completion.md) + + ### repeatable [!badge Boolean] diff --git a/src/configuration/command.md b/src/configuration/command.md index 8e973f4..b6ba6ef 100644 --- a/src/configuration/command.md +++ b/src/configuration/command.md @@ -295,6 +295,11 @@ To access arguments captured by `catch_all` in your script, use the Specify an array of additional completion suggestions when used in conjunction with `bashly add completions`. +This command-level option is supported as a fallback for positional arguments, +but it is discouraged for new configurations. Prefer setting +[`completions`](argument.md#completions) on the relevant argument, or on the +relevant [`flag`](flag.md#completions) when completing a flag value. + [!ref](/advanced/bash-completion.md) diff --git a/src/configuration/flag.md b/src/configuration/flag.md index d9dc3d6..7c95333 100644 --- a/src/configuration/flag.md +++ b/src/configuration/flag.md @@ -154,8 +154,8 @@ This option should be specified on both sides of the exclusivity. [!badge Array of Strings] -Specify an array of additional completion suggestions when used in conjunction -with `bashly add completions`. +Specify an array of additional completion suggestions for this flag's value +when used in conjunction with `bashly add completions`. Remember to set the [`arg`](#arg) name when using this option. From e3a1dbb2aaf26ae485000a5185f746d4e9a7ef5e Mon Sep 17 00:00:00 2001 From: Danny Ben Shitrit Date: Wed, 8 Jul 2026 20:10:45 +0300 Subject: [PATCH 2/3] - Add `flag.alias` --- .github/workflows/build.yml.disabled | 31 -------- _typos.toml | 10 +++ op.conf | 2 +- src/configuration/flag.md | 15 ++++ test/aspell-custom-dict.txt | 101 --------------------------- test/spell_check.sh | 22 +----- test/test.yml | 33 --------- 7 files changed, 29 insertions(+), 185 deletions(-) delete mode 100644 .github/workflows/build.yml.disabled create mode 100644 _typos.toml delete mode 100644 test/aspell-custom-dict.txt delete mode 100644 test/test.yml diff --git a/.github/workflows/build.yml.disabled b/.github/workflows/build.yml.disabled deleted file mode 100644 index a8f7e40..0000000 --- a/.github/workflows/build.yml.disabled +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish to GitHub Pages - -on: - workflow_dispatch: - push: - branches: [master] - -jobs: - publish: - name: Publish to retype branch - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - name: Check out code - uses: actions/checkout@v3 - - # This should not be needed, but it is a workaround - # ref: https://github.com/retypeapp/retype/issues/711 - - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 7.0.x - - - name: Build site - uses: retypeapp/action-build@latest - - - name: Publish to GitHub Pages - uses: retypeapp/action-github-pages@latest - with: - update-branch: true diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000..c735731 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,10 @@ +# [default] +# extend-ignore-identifiers-re = [ +# "fo", +# ] + +[files] +extend-exclude = [ + "*.svg", +] + diff --git a/op.conf b/op.conf index ce045c3..33c495f 100644 --- a/op.conf +++ b/op.conf @@ -16,7 +16,7 @@ build: rm -rfv docs/* ; retype build test: test/test.sh #? run tests -spell: test/spell_check.sh +spell: typos #? run spellcheck tests sla: test/broken_links.sh diff --git a/src/configuration/flag.md b/src/configuration/flag.md index 7c95333..59615c8 100644 --- a/src/configuration/flag.md +++ b/src/configuration/flag.md @@ -16,6 +16,7 @@ flags: - long: --user short: -u + alias: --username arg: name help: Repository user name. required: true @@ -84,6 +85,20 @@ The `-v` and `-h` flags will be used as the short options for `--version` and `- !!! +### alias + +[!badge String / Array of Strings] + +One or more additional spellings for this flag. Each alias must include the +`--` or `-` prefix. + +!!! Note +Aliases only affect how the flag is entered by the user. In your script, the +value will still be available using the flag's canonical name, for example: +`${args[--user]}`. +!!! + + ### help [!badge String] diff --git a/test/aspell-custom-dict.txt b/test/aspell-custom-dict.txt deleted file mode 100644 index 19e205e..0000000 --- a/test/aspell-custom-dict.txt +++ /dev/null @@ -1,101 +0,0 @@ -personal_ws-1.1 en 22 -abc -Alf -alf -api -arg -args -autoload -AWS -bashcompinit -Bashly -bashly -bashly's -boolean -CentOS -changelog -CLI -cli -codescan -compgen -compinit -config -Config -dannyben -del -deps -dev -devel -dir -dnf -env -ERB -euo -eval -fi -github -gtx -heredoc -Homebrew -href -http -img -ini -INI -init -instagram -json -kbgrep -knowledgebases -libyaml -macOS -mandoc -md -mygit -myscript -nowrap -OpenRefine -orcli -pacman -pipefail -pls -png -pre -PWD -rb -readme -repo -repos -respec -rhodecode -rspec -runtime -sed -SETI -shellcheck -shfmt -src -stdin -subcommand -subcommands -sudo -Suy -td -tty -Unregister -uri -url -usr -Uz -vvv -wget -yaml -YAML -yml -yourcli -yourscript -youtube -ZSH -Zsh -zsh -zshrc \ No newline at end of file diff --git a/test/spell_check.sh b/test/spell_check.sh index 3980e86..ba4081f 100755 --- a/test/spell_check.sh +++ b/test/spell_check.sh @@ -1,24 +1,8 @@ #!/usr/bin/env bash source "test/test_helper.bash" -# Check splling errors -header "Test: Spellcheck" -for f in $(find src -name '*.md') ; do - output=$(aspell list --lang=en --personal aspell-custom-dict.txt --home-dir test < "$f" 2>&1) - printf "\033[2K\r$f" - if [[ $output ]]; then - echo " - FAILED" - failed=1 - echo "$output" - fi -done - -if [[ $failed ]]; then - echo - error "FAIL: Spellcheck" - echo " You have some typos." - echo " If they are valid, add them to test/aspell-custom-dict.txt" +header "Test: Spell check" +if ! (typos); then + error "FAIL: Broken Links" exit 1 -else - printf "\033[2K\rDone, no issues\n" fi diff --git a/test/test.yml b/test/test.yml deleted file mode 100644 index a3482f6..0000000 --- a/test/test.yml +++ /dev/null @@ -1,33 +0,0 @@ -# Test workflow -# Cannot be used at the moment, since the target folder needs to be built - -name: Test -on: - pull_request: - push: { branches: master } - -jobs: - test: - name: Run test suite - runs-on: ubuntu-latest - - steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - - name: Install linux dependencies - run: sudo apt install -y aspell aspell-en - - - name: Start static site server - run: | - httpme docs > /dev/null 2>&1 & - sleep 3 - - - name: Run tests - run: bundle exec test/test.sh From d79f266d588221c569f9b240cfca08c7bd2dc857 Mon Sep 17 00:00:00 2001 From: Danny Ben Shitrit Date: Wed, 8 Jul 2026 20:14:07 +0300 Subject: [PATCH 3/3] version 1.4.0 --- retype.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retype.yml b/retype.yml index fa92ef7..405e605 100644 --- a/retype.yml +++ b/retype.yml @@ -12,7 +12,7 @@ editor: enabled: false branding: - label: v1.3.8 + label: v1.4.0 logo: assets/logo.svg logoDark: assets/logo-dark.svg # logoWidth: 143