feat(task): implement grouped sections in help-table with centered headers and add optional path parameters to git commands
This commit is contained in:
4 files changed
+133
-15
No files matched your search
+49
-7
@@ -6,6 +6,7 @@ help-table() {
|
||||
local max_cmd=7 max_opt=6 max_desc=11
|
||||
|
||||
rows+=("Command|Option|Description")
|
||||
rows+=("<<<Task>>>| | ")
|
||||
rows+=("clone-taskfile||Clone the taskfile.build repo.")
|
||||
rows+=("init-project||Setup a taskfile project in the current directory.")
|
||||
rows+=("init-dotenv-dir||Setup task dotenv dir.")
|
||||
@@ -14,11 +15,14 @@ help-table() {
|
||||
rows+=("open-url-with-delay|[url][delay]|Open url after n seconds.")
|
||||
rows+=("show-dotenv-setup||Show info about the dotenv setup.")
|
||||
rows+=("setup-completion|[shell]|Show shell completion instructions.")
|
||||
rows+=("<<<Files>>>| | ")
|
||||
rows+=("ensure-directory|[path]|Ensure directory path exists.")
|
||||
rows+=("create-symlink|[target][source]|Remove existing file/directory and create symlink.")
|
||||
rows+=("create-symlink-files|[target][source]|Create symlink for files in source pattern.")
|
||||
rows+=("<<<Python>>>| | ")
|
||||
rows+=("activate-venv||Activate or initialize Python virtual env.")
|
||||
rows+=("remove-venv||Remove the Python virtual env.")
|
||||
rows+=("<<<Environment>>>| | ")
|
||||
rows+=("create-dotenv|[env][type]|Create .env file of type nextcloud, odoo, upgrade.")
|
||||
rows+=("list-dotenv||List dotenv files.")
|
||||
rows+=("show-dotenv|[env]|Output content of the .env file.")
|
||||
@@ -29,34 +33,42 @@ help-table() {
|
||||
rows+=("remove-dotenv|[env]|Remove .env file.")
|
||||
rows+=("backup-dotenv-files|[path]|Archive and copy .env files to target location.")
|
||||
rows+=("restore-dotenv-files|[path]|Extract and copy .env files from backup file.")
|
||||
rows+=("<<<LLM>>>| | ")
|
||||
rows+=("commit-with-llm||Commit with llm generated commit message.")
|
||||
rows+=("update-with-llm|[glob][prompt]|Feed files matching glob to LLM and apply changes.")
|
||||
rows+=("update-changelog-with-llm||Update CHANGELOG.md with changes from staged git diff using LLM.")
|
||||
rows+=("create-prompt||Create a new prompt file from template.")
|
||||
rows+=("list-prompts||List all prompt files.")
|
||||
rows+=("<<<Logging>>>| | ")
|
||||
rows+=("log-error||Colored output for errors.")
|
||||
rows+=("log-success||Colored output for success.")
|
||||
rows+=("log-warning||Colored output for warnings.")
|
||||
rows+=("<<<Git>>>| | ")
|
||||
rows+=("commit-git-folder|[message][path]|Commit all changes in git folders in path.")
|
||||
rows+=("clean-git-folder||Clean git folder.")
|
||||
rows+=("clean-git-folder|[path]|Clean git folder.")
|
||||
rows+=("ls-git-folder|[path]|Space separated list of git folders in path.")
|
||||
rows+=("push-git-folder||Push all git folders in path.")
|
||||
rows+=("reset-git-folder||Abort, rebase and reset git folder.")
|
||||
rows+=("push-git-folder|[path]|Push all git folders in path.")
|
||||
rows+=("reset-git-folder|[path]|Abort, rebase and reset git folder.")
|
||||
rows+=("stage-git-folder|[path]|Stage all files in git folders in path.")
|
||||
rows+=("status-git-folder|[path]|Show status of git folders in path.")
|
||||
rows+=("update-submodule||Update git submodules.")
|
||||
rows+=("<<<Pass>>>| | ")
|
||||
rows+=("save-dotenv-to-pass|[file]|Store content of .env in pass entry.")
|
||||
rows+=("load-dotenv-from-pass|[file]|Restore content to .env from pass entry.")
|
||||
rows+=("<<<KeePass>>>| | ")
|
||||
rows+=("save-pass-to-keepass|[pass][entry]|Store password to KeePass entry.")
|
||||
rows+=("get-pass-from-keepass|[entry]|Get password from KeePass entry.")
|
||||
rows+=("save-dotenv-to-keepass|[file]|Store content of .env in KeePass entry.")
|
||||
rows+=("load-dotenv-from-keepass|[file]|Restore content to .env from KeePass entry.")
|
||||
rows+=("<<<Kubernetes>>>| | ")
|
||||
rows+=("save-kubeconfig-to-pass|[ctx]|Save kubeconfig file in pass.")
|
||||
rows+=("save-kubeconfig-to-keepass|[ctx]|Save kubeconfig file in KeePass.")
|
||||
rows+=("load-kubeconfig-from-pass|[ctx]|Load kubeconfig file from pass.")
|
||||
rows+=("load-kubeconfig-from-keepass|[ctx]|Load kubeconfig file from KeePass.")
|
||||
rows+=("<<<Docker>>>| | ")
|
||||
rows+=("login-docker|[user][token]|Run Docker login and create docker config.")
|
||||
rows+=("build-image|[output]|Build Docker image with buildx.")
|
||||
rows+=("<<<Ansible>>>| | ")
|
||||
rows+=("install-ansible-build-scripts|[role]|Install scripts of the specified Ansbile role.")
|
||||
|
||||
for row in "${rows[@]}"; do
|
||||
@@ -76,12 +88,42 @@ help-table() {
|
||||
"$max_opt" "$(printf '%*s' "$max_opt" '' | tr ' ' '-')" \
|
||||
"$max_desc" "$(printf '%*s' "$max_desc" '' | tr ' ' '-')"
|
||||
|
||||
local first_row=true
|
||||
for row in "${rows[@]:1}"; do
|
||||
IFS='|' read -r cmd opt desc <<< "$row"
|
||||
printf '| %-*s | %-*s | %-*s |\n' \
|
||||
"$max_cmd" "$cmd" \
|
||||
"$max_opt" "$opt" \
|
||||
"$max_desc" "$desc"
|
||||
if [[ "$cmd" =~ ^\<\<\<.*\>\>\>$ ]]; then
|
||||
group_name="${cmd/\<\<\</}"
|
||||
group_name="${group_name/\>\>\>/}"
|
||||
|
||||
if [ "$first_row" = true ]; then
|
||||
first_row=false
|
||||
else
|
||||
printf '|-%*s-|-%*s-|-%*s-|\n' \
|
||||
"$max_cmd" "$(printf '%*s' "$max_cmd" '' | tr ' ' '-')" \
|
||||
"$max_opt" "$(printf '%*s' "$max_opt" '' | tr ' ' '-')" \
|
||||
"$max_desc" "$(printf '%*s' "$max_desc" '' | tr ' ' '-')"
|
||||
fi
|
||||
|
||||
local left_pad=$(( (max_cmd - ${#group_name}) / 2 ))
|
||||
local right_pad=$(( max_cmd - left_pad - ${#group_name} ))
|
||||
printf '| %*s%s%*s | %*s | %*s |\n' \
|
||||
"$left_pad" "" \
|
||||
"$group_name" \
|
||||
"$right_pad" "" \
|
||||
"$max_opt" "" \
|
||||
"$max_desc" ""
|
||||
|
||||
printf '|-%*s-|-%*s-|-%*s-|\n' \
|
||||
"$max_cmd" "$(printf '%*s' "$max_cmd" '' | tr ' ' '-')" \
|
||||
"$max_opt" "$(printf '%*s' "$max_opt" '' | tr ' ' '-')" \
|
||||
"$max_desc" "$(printf '%*s' "$max_desc" '' | tr ' ' '-')"
|
||||
else
|
||||
first_row=false
|
||||
printf '| %-*s | %-*s | %-*s |\n' \
|
||||
"$max_cmd" "$cmd" \
|
||||
"$max_opt" "$opt" \
|
||||
"$max_desc" "$desc"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user