diff --git a/build/_build-dir b/build/_build-dir index fb7aaf9..62473e3 100644 --- a/build/_build-dir +++ b/build/_build-dir @@ -1,6 +1,7 @@ #compdef build-dir _arguments \ - '(-h --help)'{-h,--help}'[]' \ + '(-h --help)'{-h,--help}'[show this help message and exit]' \ + '(-s --show)'{-s,--show}'[show the current build directory]' \ '--build[invoke a build after selection]' \ '1:directory:_files' diff --git a/build/build.plugin.zsh b/build/build.plugin.zsh index b2fbffa..4abb0cd 100644 --- a/build/build.plugin.zsh +++ b/build/build.plugin.zsh @@ -32,8 +32,8 @@ fi # Interactively choose a `~build` directory for `build` to build. build-dir() { local usage='usage: build-dir [-h] [--build] []' - local -a help do_build - zparseopts -D h=help -help=help -build=do_build + local -a help show do_build + zparseopts -D h=help -help=help s=show -show=show -build=do_build if [[ -n $help ]]; then cat << EOF $usage @@ -45,12 +45,22 @@ positional arguments: optional arguments: -h, --help show this help message and exit + -s, --show show the current build directory --build invoke a build after selection EOF return fi error() { echo "\e[31merror:\e[0m $1" } warning() { echo "\e[33mwarning:\e[0m $1" } + if [[ -n $show ]]; then + if [[ ! -n $build_dir ]]; then + error "build directory not set" + return 1 + else + echo "$build_dir" + return + fi + fi local local_build_dir if [[ ${#*} -gt 1 ]]; then echo $usage