Zsh CLI Tutorial — getopts, Colors, Progress Bars & Todo App #26
16views
2likes
012:23
T
Taught by Celeste AI - AI Coding Coach
View on YouTubeDescription
Learn how to build professional command-line tools in Zsh! This lesson covers argument parsing with getopts, colored output with ANSI codes, spinners and
progress bars, plus a complete todo CLI app with subcommands.
🔗 Source code: https://github.com/GoCelesteAI/zsh_building_cli_tool
⏱️ Timestamps:
0:00 — Intro
0:26 — CLI Foundations Explained
1:11 — CLI Foundations Demo
3:37 — CLI Polish Explained
4:22 — CLI Polish Demo
7:10 — Complete CLI App Explained
7:55 — Complete CLI App Demo
11:10 — Recap
11:52 — End
📋 Topics covered:
• getopts: parse -v, -n value, -h flags in a while loop
• OPTARG: access the value passed to a flag
• OPTIND + shift: access positional arguments after flags
• usage() function: document your tool with a help message
• Exit codes: 0 for success, 1 for errors, 2 for usage errors
• ANSI escape codes: \e[32m green, \e[31m red, \e[33m yellow, \e[0m reset
• Color helpers: success(), error(), warn(), info() functions
• Spinner animation: \r overwrite with |/-\ characters
• Progress bar: [####....] with printf formatting
• Interactive prompts: read "response?prompt" for user input
• Subcommand routing: case "$1" in add|list|done|remove
• File-backed storage: plain text with sed for in-place edits
• Complete todo CLI: add, list, done, remove subcommands
🎬 Part of the Zsh Shell Tutorial series — subscribe for weekly lessons!
Back to tutorialsOpen in YouTube
Duration
12:23
Published
February 18, 2026
Added to Codegiz
March 15, 2026