Skip to main content

Practice ยท 1 of 1

Subcommand Router

Implement main(argv) (argv is a list like ['add', 'milk']) returning the exit code int: 'add' with text โ†’ prints 'added: <text>' and returns 0; 'list' โ†’ prints '2 tasks' and returns 0; unknown command or 'add' without text โ†’ prints the error to stderr and returns 2. (The grader captures stdout/stderr.)

Difficulty: intermediate

Back to lesson: Practice: CLI Entry Drills