Tutorials - Reka Horvath: Building human-first and machine-friendly CLI applications

Learn how to build human-first and machine-friendly CLI applications using best practices and popular tools like clig.dev, cookiecutter, and typer.

Key takeaways
  • Use a site such as clig.dev for building human-first and machine-friendly CLI applications.
  • Consider using a command-line argument parsing library.
  • Use a template, such as cookiecutter, to create a project structure and enable consistency across the application.
  • The principle of least surprise should guide the design of the CLI.
  • Consistency is key to a user-friendly CLI, and shared options can help achieve this.
  • Validate user input to prevent errors and improve the user experience.
  • Use typer to generate help text and other output.
  • Include interactive features, such as prompts, to make the CLI more user-friendly.
  • Use standard output and standard error to provide feedback to the user.
  • Consider using a completion script to help users complete commands.
  • Keep the code simple and easy to understand.
  • Test the CLI thoroughly to ensure it works as expected.
  • Use a framework, such as clique, to simplify the process of building a CLI.