Skip to content

Commit

Permalink
doc: add help for zs
Browse files Browse the repository at this point in the history
  • Loading branch information
Wen-Shih Chao authored and Wen-Shih Chao committed Aug 9, 2024
1 parent 45a5526 commit 135195a
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions scripts/zs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -Eeuo pipefail

readonly ZS_PROGRAM="${HOME}/Trek/zuul-ls/target/debug/zuul-search"
readonly ZS_PROGRAM="${ZUUL_SEARCH_BIN_PATH:-"zuul-search"}"

zs-job() {
local -r result=$(${ZS_PROGRAM} jobs | \
Expand Down Expand Up @@ -147,9 +147,32 @@ zs-roles() {
fi
}

show_help() {
echo "zs - zuul search - Search zuul config with zuul-search, fzf and bat"
echo ""
echo "Command:"
echo " zs <search> [job_name]"
echo " j,jobs - Search all jobs"
echo " h,hierarchy - Search the job hierarchy of a job"
echo " v,vars - Search job variables of a job"
echo " wv,workdir-vars - Search variables in cwd"
echo " p,playbooks - Search playbooks of a job"
echo " t,project-templates - Search all project-templates"
echo " help - Show the help"
echo ""
echo "Example:"
echo " zs j - Search all jobs"
echo " zs job - Same as 'zs j'"
echo ""
echo " zs h - Search the job name first, search the job hierarchy of the job name"
echo " zs hierarchy - Same as 'zs h'"
echo ""
echo " zs h zuul-job - Search the job hierarhcy of 'zuul-job'"
}

main() {
if [[ "$#" == "0" ]]; then
echo "help"
show_help
exit 0
fi

Expand Down Expand Up @@ -199,8 +222,11 @@ main() {
project-templates)
zs-project-templates
;;
help)
show_help
;;
*)
echo "help"
show_help
;;
esac
}
Expand Down

0 comments on commit 135195a

Please sign in to comment.