โŒจ๏ธ
๐Ÿ“ Build CLI Tools with Larz ยท LARZ-801 ยท Assignments

Build CLI Tools with Larz โ€” Assignments

Work each problem yourself first, then open the worked solution to check your thinking. This is where the course sticks.

๐Ÿ“ 4 problemsโœ๏ธ Worked solutions
Problem 1

Turn one repetitive task you do into a plan for a small CLI tool.

Show worked solution

A strong answer identifies a genuinely repetitive task, sketches the function that would do it, and notes how larzcli would expose it as a command (arguments from parameters, help from the docstring). It reflects the leverage argument: an hour to build saves time repeatedly, and CLIs are easy to share.

Problem 2

Describe how larzcli builds config layering and why CLI > env > default is the right order.

Show worked solution

Good answers explain that a flag (most specific, one run) should beat an environment variable (a session) which beats a built-in default, matching user expectations and 12-factor practice, and that larzcli provides this automatically plus testable parse()/invoke(). The insight is convenience without hand-wiring precedence.

Problem 3

Explain why terminal output must be width-aware and pipe-safe, per larztui.

Show worked solution

Strong answers note that colour codes are invisible characters that (1) throw off column alignment unless you measure visible width, and (2) become garbage when output is piped to a file/program, so colour must auto-disable off a terminal. larztui handles both, giving pretty output for humans and clean output for machines.

Problem 4

Outline how you'd package a CLI so someone can pip install and run it.

Show worked solution

A good answer describes a pyproject.toml with metadata and a [project.scripts] entry point mapping a command name to a function, so pip install puts the command on the PATH, plus a README and optional PyPI publishing. Bonus: notes zero-dependency tools install cleanly for users.

More in this course

Course home → · Browse all courses →