Which packages do you recommend for building cli tools?

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • Mergify - Updating dependencies is time-consuming.
  • SonarQube - Static code analysis for 29 languages.
  • cobra

    A Commander for modern Go CLI interactions

    Cobra and Viper.

  • urfave/cli

    A simple, fast, and fun package for building command line apps in Go (by urfave)

  • InfluxDB

    Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.

  • viper

    Go configuration with fangs

    Cobra and Viper.

  • bubbletea

    A powerful little TUI framework 🏗

    Don't forget https://github.com/charmbracelet/bubbletea and the rest of the https://charm.sh suite!

  • kong

    Kong is a command-line parser for Go (by alecthomas)

    I prefer https://github.com/alecthomas/kong these days

  • warg

    Declarative and Intuitive Command Line Apps with Go

    I wrote my own! https://github.com/bbkane/warg/

  • ff

    Flags-first package for configuration

  • Mergify

    Updating dependencies is time-consuming.. Solutions like Dependabot or Renovate update but don't merge dependencies. You need to do it manually while it could be fully automated! Add a Merge Queue to your workflow and stop caring about PR management & merging. Try Mergify for free.

  • pflag

    Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.

    I realy enjoyed the patched version from spf13 with "--" support https://github.com/spf13/pflag

  • go-flags

    go command line option parser

    https://github.com/jessevdk/go-flags provides a pretty neat way to specify flags and handle commands. Not so much extensible as cobra, but good enough for small cli tools

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts