Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 28 additions & 23 deletions examples/completions/src/lib/send_completions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,38 @@ send_completions() {
echo $'# Modifying it manually is not recommended'
echo $''
echo $'_cli_completions_filter() {'
echo $' local words=("$@")'
echo $' local words="$1"'
echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
echo $' local result=()'
echo $' local want_options=0'
echo $''
echo $' # words the user already typed (excluding the command itself)'
echo $' local used=()'
echo $' if ((COMP_CWORD > 1)); then'
echo $' used=("${COMP_WORDS[@]:1:$((COMP_CWORD - 1))}")'
echo $' fi'
echo $''
echo $' # Completing an option: offer everything.'
echo $' # Completing a non-option: drop options and already-used words.'
echo $' [[ "${cur:0:1}" == "-" ]] && want_options=1'
echo $' for word in "${words[@]}"; do'
echo $' if ((!want_options)); then'
echo $' if [[ "${cur:0:1}" == "-" ]]; then'
echo $' # Completing an option: offer everything (including options)'
echo $' echo "$words"'
echo $''
echo $' else'
echo $' # Completing a non-option: offer only non-options,'
echo $' # and don\'t re-offer ones already used earlier in the line.'
echo $' for word in $words; do'
echo $' [[ "${word:0:1}" == "-" ]] && continue'
echo $''
echo $' local seen=0'
echo $' for u in "${used[@]}"; do'
echo $' if [[ "$u" == "$word" ]]; then'
echo $' continue 2'
echo $' seen=1'
echo $' break'
echo $' fi'
echo $' done'
echo $' fi'
echo $''
echo $' # compgen -W expects shell-escaped words in one space-delimited string.'
echo $' printf -v word \'%q\' "$word"'
echo $' result+=("$word")'
echo $' done'
echo $' ((!seen)) && result+=("$word")'
echo $' done'
echo $''
echo $' echo "${result[*]}"'
echo $' echo "${result[*]}"'
echo $' fi'
echo $'}'
echo $''
echo $'_cli_completions() {'
Expand All @@ -52,51 +53,55 @@ send_completions() {
echo $''
echo $' case "$compline" in'
echo $' \'download\'*\'--handler\')'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "curl" "wget")" -- "$cur")'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "curl wget")" -- "$cur")'
echo $' ;;'
echo $''
echo $' \'upload\'*\'--user\')'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")'
echo $' ;;'
echo $''
echo $' \'completions\'*)'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--help" "-h")" -- "$cur")'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--help -h")" -- "$cur")'
echo $' ;;'
echo $''
echo $' \'d\'*\'--handler\')'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "curl" "wget")" -- "$cur")'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "curl wget")" -- "$cur")'
echo $' ;;'
echo $''
echo $' \'upload\'*\'-u\')'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")'
echo $' ;;'
echo $''
echo $' \'download\'*)'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_cli_completions_filter "--force" "--handler" "--help" "-f" "-h")" -- "$cur")'
echo $' compopt -o filenames 2>/dev/null'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_cli_completions_filter "--force --handler --help -f -h")" -- "$cur")'
echo $' ;;'
echo $''
echo $' \'u\'*\'--user\')'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")'
echo $' ;;'
echo $''
echo $' \'upload\'*)'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A user -W "$(_cli_completions_filter "--help" "--password" "--user" "-h" "-p" "-u" "CHANGELOG.md" "README.md")" -- "$cur")'
echo $' compopt -o filenames 2>/dev/null'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A user -W "$(_cli_completions_filter "--help --password --user -h -p -u CHANGELOG.md README.md")" -- "$cur")'
echo $' ;;'
echo $''
echo $' \'u\'*\'-u\')'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A user -- "$cur")'
echo $' ;;'
echo $''
echo $' \'d\'*)'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_cli_completions_filter "--force" "--handler" "--help" "-f" "-h")" -- "$cur")'
echo $' compopt -o filenames 2>/dev/null'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A file -W "$(_cli_completions_filter "--force --handler --help -f -h")" -- "$cur")'
echo $' ;;'
echo $''
echo $' \'u\'*)'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A user -W "$(_cli_completions_filter "--help" "--password" "--user" "-h" "-p" "-u" "CHANGELOG.md" "README.md")" -- "$cur")'
echo $' compopt -o filenames 2>/dev/null'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -A directory -A user -W "$(_cli_completions_filter "--help --password --user -h -p -u CHANGELOG.md README.md")" -- "$cur")'
echo $' ;;'
echo $''
echo $' *)'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--help" "--version" "-h" "-v" "completions" "d" "download" "u" "upload")" -- "$cur")'
echo $' while read -r; do COMPREPLY+=("$REPLY"); done < <(compgen -W "$(_cli_completions_filter "--help --version -h -v completions d download u upload")" -- "$cur")'
echo $' ;;'
echo $''
echo $' esac'
Expand Down
2 changes: 1 addition & 1 deletion examples/render-mandoc/docs/download.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.9
.\"
.TH "download" "1" "February 2026" "Version 0.1.0" "Sample application"
.TH "download" "1" "March 2026" "Version 0.1.0" "Sample application"
.SH NAME
\f[B]download\f[R] \- Sample application
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion examples/render-mandoc/docs/download.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
% download(1) Version 0.1.0 | Sample application
% Lana Lang
% February 2026
% March 2026

NAME
==================================================
Expand Down
15 changes: 0 additions & 15 deletions lib/bashly/libraries/libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,6 @@ strings:
- source: "strings/strings.yml"
target: "%{user_source_dir}/bashly-strings.yml"

test:
help: Add approval testing.
files:
- source: "test/approvals.bash"
target: "%{user_target_dir}/test/approvals.bash"
- source: "test/approve"
target: "%{user_target_dir}/test/approve"

post_install_message: |
Edit your tests in g`test/approve` and then run:

m`$ test/approve`

Docs: bu`https://github.com/DannyBen/approvals.bash`

validations:
help: Add argument validation functions to the lib directory.
files:
Expand Down
172 changes: 0 additions & 172 deletions lib/bashly/libraries/test/approvals.bash

This file was deleted.

25 changes: 0 additions & 25 deletions lib/bashly/libraries/test/approve

This file was deleted.

Loading
Loading