Generated scripts now have an `install` verb next to check/env/update:
- Script:install_requirements parses the Os:require calls in the script
and offers to install every missing binary with the package manager
detected in Script:meta (or the install hint of the Os:require call)
- Script:install_symlink links the script into the first writable folder
of $HOME/.local/bin, $HOME/bin or /usr/local/bin - this step is skipped
when the script was installed with basher, which already does this
- Script:install_completion generates a bash/zsh completion script from
Option:config (flags, options and choice values) and activates it in
~/.bashrc and ~/.zshrc
All steps ask for confirmation (unless -f/--FORCE) and are idempotent.
Os:require no longer dies during the install action, so the install verb
can actually fix the missing binaries it reports.
Also fixes a stray "flazg_set" fragment in bashew.sh that made
`bashew check` print a "command not found" error and broke shellcheck.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013CTqVsScAVUbkTAQB9gMyA
Adds an
installverb to the generated scripts, next to the existingcheck,envandupdateverbs.installaction that handles dependency checking and bash/zsh completion setupOs:requirecalls to find dependenciesOption:configWhat it does
$script_prefix installruns three steps, each one asking for confirmation (or skipping the question with-f/--FORCE), and all three are idempotent:Script:list_requirementsgreps the realOs:requirecalls out of the script (comments and the documentation header are ignored) and turns them into<binary><tab><install hint>. Every missing binary is offered for installation, using the same logic asOs:require: the install hint of the call, or the package manager detected inScript:meta(brew install,apt install,apk add, …).$HOME/.local/bin,$HOME/bin,/usr/local/bin(offering to create$HOME/.local/binif none exists, and warning when it is not in$PATH). Skipped when the script lives under.basher/or$BASHER_ROOT, because basher already creates that link.Script:completiongenerates a bash/zsh completion script fromOption:config()(short + long names of flags/options/lists, plus all values of thechoiceline) into~/.bash_completion.d/<script>, and activates it in~/.bashrcand~/.zshrc(withbashcompinitfor zsh). Startup files that do not exist are left alone.Os:requireno longer dies during theinstallaction, otherwise a script with a missing dependency would exit beforeScript:installcould offer to install it. All other actions keep the current behaviour.Also included: a stray
, flazg_setfragment on line 270 ofbashew.sh(introduced in 61ac1c0) madebashew checkprintline 270: ,: command not foundand madeshellcheckfail on the repo root, so it is removed here.Test plan
shellcheck bashew.sh template/script.sh— cleanbash_unit tests/test_*— all bashew tests pass (test_slugifyfails identically before and after this change, it needs theen_US.UTF-8locale)bashew.sh scriptand raninstall: dependency check, symlink creation, completion file,.bashrc/.zshrcactivation, and a second run that correctly reports everything as already installed--optionsand the action choices.basher/and under$BASHER_ROOTGenerated by Claude Code