JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Help patterns in CLI: app help, app <cmd> -h

    Go SELF
    50 level,0 lecture
    We break down the UX contract of CLI help: how help differs from usage, which three help entry points users expect ( todo help, todo <cmd> -h, todo help <cmd>), how to keep a single format ( Usage/ Commands/ Flags/ Examples), and how to implement it in Go via flag.FlagSet, overriding Usage, and printing flags automatically with PrintDefaults(), while following the rule: help and errors go to stderr, command results go to stdout.
    Open
  • Exit codes in CLI: help=0, usage=2, runtime/internal=1

    Go SELF
    50 level,1 lecture
    We lock in a simple and predictable contract for CLI: 0 — help ( -h, help), 2 — startup error (arguments/flags/validation), 1 — runtime/internal failure. We break down why flag.ErrHelp is not usage, why os.Exit must exist only at the top level ( main()), and how to classify errors by type via usageError without relying on message text. Plus: a control-flow diagram and common mistakes.
    Open
  • Env config in a CLI: precedence and fail fast

    Go SELF
    50 level,2 lecture
    Let’s break down how to configure a Go CLI via environment variables and flags without any “magic”: how os.Getenv differs from os.LookupEnv, how to lock in the precedence flags > env > default, how to write small helpers ( envString, envInt), and how to validate config using the fail-fast principle. In practice, we’ll wire TODO_DATA_FILE and TODO_TIMEOUT_SEC settings into the educational todo, add friendly error messages, and mention env vars in help output.
    Open
  • Input validation — short messages for the user

    Go SELF
    50 level,3 lecture
    We break down why input validation is part of UX in a CLI: separating flag parsing from semantic validation, classifying errors as usage and runtime/internal, introducing the usageError type (instead of analyzing the text of err.Error()), setting up stable exit codes ( 0/ 1/ 2), and writing short “fixable” messages with a hint ( todo add -h).
    Open
  • Reading stdin in a CLI: how to do it safely and predictably

    Go SELF
    50 level,4 lecture
    We break down how to design reading from stdin in a CLI so the utility does not unexpectedly “hang”: input only via an explicit - protocol, unifying input through io.ReadCloser and io.NopCloser, reading one/multiple lines with bufio.Scanner, safely “read everything” via io.LimitReader, and also UX practices: separating errors into usage (exit code 2) vs runtime (exit code 1) and hints for interactive input.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush