feat: add project initialization script and template files with dynamic help table
- Added `init-project` script to setup new taskfile projects with templates - Created `.gitignore.template` and `AGENTS.md.template` for standardized project setup - Implemented dynamic help table generation in `help-table` function - Updated `library.md` and `task.template` to include new `init-project` command - Added `init-project` to taskfile help documentation - Improved AGENTS.md with comprehensive coding conventions and agent guidance
This commit is contained in:
10 files changed
+333
-212
No files matched your search
@@ -2,25 +2,47 @@
|
||||
set -e
|
||||
|
||||
help-table() {
|
||||
local cmd_width=20
|
||||
local opt_width=10
|
||||
local desc_width=42
|
||||
local column="| %-${cmd_width}s | %-${opt_width}s | %-${desc_width}s |\n"
|
||||
local -a rows
|
||||
local max_cmd=7 max_opt=6 max_desc=11
|
||||
|
||||
printf "$column" 'Command' 'Option' 'Description'
|
||||
echo "|$(printf '%*s' $((cmd_width + 2)) '' | tr ' ' '-')|$(printf '%*s' $((opt_width + 2)) '' | tr ' ' '-')|$(printf '%*s' $((desc_width + 2)) '' | tr ' ' '-')|"
|
||||
printf "$column" 'all' '' 'Run all tasks.'
|
||||
printf "$column" 'build-11ty' '' 'Build the 11ty website.'
|
||||
printf "$column" 'build-image' '[output]' 'Build Docker image with buildx.'
|
||||
printf "$column" 'commit-with-llm' '' 'Commit with llm generated commit message.'
|
||||
printf "$column" 'dev-11ty' '' 'Run 11ty server.'
|
||||
printf "$column" 'help' '[grep]' 'Show help for commands.'
|
||||
printf "$column" 'install' '' 'Install node packages.'
|
||||
printf "$column" 'lint' '' 'Lint code with prettier.'
|
||||
printf "$column" 'run' '' 'Run Docker image.'
|
||||
printf "$column" 'run-tests' '' 'Test with shellcheck.'
|
||||
printf "$column" 'serve-11ty' '' 'Serve the 11ty output folder.'
|
||||
printf "$column" 'version' '' 'Show version of required tools.'
|
||||
rows+=("Command|Option|Description")
|
||||
rows+=("all||Run all tasks.")
|
||||
rows+=("build-11ty||Build the 11ty website.")
|
||||
rows+=("build-image|[output]|Build Docker image with buildx.")
|
||||
rows+=("commit-with-llm||Commit with llm generated commit message.")
|
||||
rows+=("dev-11ty||Run 11ty server.")
|
||||
rows+=("help|[grep]|Show help for commands.")
|
||||
rows+=("install||Install node packages.")
|
||||
rows+=("lint||Lint code with prettier.")
|
||||
rows+=("run||Run Docker image.")
|
||||
rows+=("run-tests||Test with shellcheck.")
|
||||
rows+=("serve-11ty||Serve the 11ty output folder.")
|
||||
rows+=("version||Show version of required tools.")
|
||||
|
||||
for row in "${rows[@]}"; do
|
||||
IFS='|' read -r cmd opt desc <<< "$row"
|
||||
(( ${#cmd} > max_cmd )) && max_cmd=${#cmd}
|
||||
(( ${#opt} > max_opt )) && max_opt=${#opt}
|
||||
(( ${#desc} > max_desc )) && max_desc=${#desc}
|
||||
done
|
||||
|
||||
printf '| %-*s | %-*s | %-*s |\n' \
|
||||
"$max_cmd" "Command" \
|
||||
"$max_opt" "Option" \
|
||||
"$max_desc" "Description"
|
||||
|
||||
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 ' ' '-')"
|
||||
|
||||
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"
|
||||
done
|
||||
}
|
||||
|
||||
help() {
|
||||
|
||||
Reference in new issue
Block a user