SHORTLIST20
中文
Englishالعربية中文日本語한국어EspañolFrançaisहिन्दी
编程

前 20 Go(Golang)命令行应用库

Cobra, urfave/cli, Kong, Bubble Tea, pflag and other ways to parse flags and commands or build a terminal UI in Go

更新于 · GitHub stars (stars)

为什么是这20个

Ranked by GitHub stars: how many developers bookmarked the project. Stars measure attention, not fit, so each row also shows forks, licence and the last push. The list mixes two choices: command and flag parsers (Cobra, urfave/cli, Kong, pflag) that decide how your tool reads its arguments, and terminal UI kits (Bubble Tea, tview, termui) for full-screen interactive apps; many tools use one of each. Older projects keep stars after activity slows: check the last push. It doesn't show which one gives shell completion or man pages.

这份清单有用吗?
  1. 1

    bubbletea

    Go framework to build terminal apps, based on The Elm Architecture.

    45,873 stars 1,888 forkslast push 2026-11-25GoMIT

    也在: #1 Go command line libraries#1 Go (Golang) terminal UI libraries

  2. 2

    cobra

    Commander for modern Go CLI interactions.

    44,829 stars 3,729 forkslast push 2026-07-11GoApache-2.0

    也在: #2 Go command line libraries

  3. 3

    urfave/cli

    Simple, fast, and fun package for building command line apps in Go (formerly codegangsta/cli).

    24,330 stars 1,970 forkslast push 2026-11-16GoMIT

    也在: #3 Go command line libraries

  4. 4

    termui

    Go terminal dashboard based on **termbox-go** and inspired by blessed-contrib.

    13,588 stars 817 forkslast push 2025-07-10GoMIT

    也在: #6 Go command line libraries#4 Go (Golang) terminal UI libraries

  5. 5

    lipgloss

    Declaratively define styles for color, format and layout in the terminal.

    12,059 stars 545 forkslast push 2026-11-22GoMIT

    也在: #7 Go command line libraries#5 Go (Golang) terminal UI libraries

  6. 6

    gocui

    Minimalist Go library aimed at creating Console User Interfaces.

    10,624 stars 644 forkslast push 2025-05-01GoBSD-3-Clause

    也在: #8 Go command line libraries#6 Go (Golang) terminal UI libraries

  7. 7

    bubbles

    TUI components for bubbletea.

    9,078 stars 494 forkslast push 2026-11-22GoMIT

    也在: #9 Go command line libraries#7 Go (Golang) terminal UI libraries

  8. 8

    huh

    Lightweight library for building interactive forms and prompts in the terminal.

    7,271 stars 285 forkslast push 2026-10-01GoMIT

    也在: #10 Go command line libraries#8 Go (Golang) terminal UI libraries

  9. 9

    pterm

    A library to beautify console output on every platform with many combinable components.

    5,573 stars 229 forkslast push 2026-10-12GoMIT

    也在: #12 Go command line libraries#9 Go (Golang) terminal UI libraries

  10. 10

    go-prompt

    Library for building a powerful interactive prompt, inspired by python-prompt-toolkit.

    5,499 stars 373 forkslast push 2025-08-12GoMIT

    也在: #13 Go command line libraries#10 Go (Golang) terminal UI libraries

  11. 11

    termbox-go

    Termbox is a library for creating cross-platform text-based interfaces.

    4,785 stars 371 forkslast push 2026-08-23GoMIT

    也在: #14 Go command line libraries#11 Go (Golang) terminal UI libraries

  12. 12

    progressbar

    Basic thread-safe progress bar that works in every OS.

    4,704 stars 266 forkslast push 2026-09-19GoMIT

    也在: #15 Go command line libraries#12 Go (Golang) terminal UI libraries

  13. 13

    glamour

    Stylesheet-based markdown rendering for terminal applications.

    3,764 stars 456 forkslast push 2026-11-24GoMIT

    也在: #16 Go command line libraries#13 Go (Golang) terminal UI libraries

  14. 14

    kingpin

    Command line and flag parser supporting sub commands (superseded by).

    3,565 stars 282 forkslast push 2026-10-20GoMIT

    也在: #17 Go command line libraries

  15. 15

    kong

    Command-line parser with support for arbitrarily complex command-line structures (successor to).

    3,211 stars 207 forkslast push 2026-11-22GoMIT

    也在: #18 Go command line libraries

  16. 16

    asciigraph

    Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies.

    3,102 stars 125 forkslast push 2026-10-17GoBSD-3-Clause

    也在: #19 Go command line libraries#14 Go (Golang) terminal UI libraries

  17. 17

    termdash

    Go terminal dashboard based on **termbox-go** and inspired by termui.

    3,049 stars 150 forkslast push 2026-09-14GoApache-2.0

    也在: #20 Go command line libraries#15 Go (Golang) terminal UI libraries

  18. 18

    go-flags

    go command line option parser.

    2,693 stars 330 forkslast push 2026-10-10GoBSD-3-Clause

  19. 19

    spinner

    Go package to easily provide a terminal spinner with options.

    2,533 stars 134 forkslast push 2026-11-16GoApache-2.0

    也在: #16 Go (Golang) terminal UI libraries

  20. 20

    mpb

    Multi progress bar for terminal applications.

    2,512 stars 132 forkslast push 2026-10-21GoUnlicense

    也在: #17 Go (Golang) terminal UI libraries

并排比较

LicenceWhat it doesKind (flag parser, command framework, terminal UI)SubcommandsBest for
bubbleteaMITGo framework for terminal apps, based on The Elm ArchitectureTerminal UI framework––
cobra–Commander for building Go CLI applications–––
urfave/cli–Package for building command line apps in Go–––
termui–Terminal dashboard library based on termbox-goTerminal UI––
lipgloss–Declarative terminal styling for colour, format and layoutTerminal UI styling––
gocui–Minimalist library for console user interfacesTerminal UI––
bubblesMITTUI components for bubbleteaTerminal UI components––
huh–Library for interactive forms and prompts in the terminalTerminal UI prompts––
pterm–Library to beautify console output with combinable components–––
go-prompt–Library for interactive prompts, inspired by python-prompt-toolkitTerminal UI prompt––
termbox-go–Library for cross-platform text-based interfacesTerminal UI––
progressbar–Thread-safe progress bar for terminal outputTerminal UI progress bar––
glamour–Stylesheet-based markdown rendering for terminal appsTerminal markdown rendering––
kingpin–Command line and flag parserFlag parserSupports sub commandsunknown (superseded, see kong)
kong–Command-line parser for GoCommand-line parserCommand structures declared as Go types with cmd tagsArbitrarily complex command-line structures
asciigraph–Lightweight ASCII line graphs for command line appsTerminal output graphing––
termdash–Terminal dashboard based on termbox-go, inspired by termuiTerminal UI––
go-flags–Go command line option parserFlag parser––
spinner–Terminal spinner with optionsTerminal UI spinner––
mpb–Multi progress bar for terminal applicationsTerminal UI progress bars––

每个单元格都来自该工具的官网、文档或代码仓库;页面列在参考资料中。

如何衡量

Every library in the 'Standard CLI' and 'Advanced Console UIs' sections of the community list avelino/awesome-go on GitHub with a public GitHub repository, ranked by GitHub stars from the GitHub API; archived repositories are left out. Refreshed every 6 hours. Finished tools listed in the same sections (vhs terminal recorder, fx JSON viewer, the elvish shell, Dnote notebook) are left out: they are apps, not libraries.

参考资料

  1. avelino/awesome-go: Standard CLI and Advanced Console UIs, GitHub community list (list text MIT; star counts from the GitHub API). Checked 2026-11-25 11:35 UTC.
  2. avelino/awesome-go (Standard CLI, Advanced Console UIs), GitHub community list, 101 tools with a public repository.
  3. bubbletea: licence, github.com, checked 2026-11-18.
  4. cobra: what it does, github.com, checked 2026-11-18.
  5. urfave/cli: what it does, github.com, checked 2026-11-18.
  6. termui: what it does, github.com, checked 2026-11-18.
  7. lipgloss: what it does, github.com, checked 2026-11-18.
  8. gocui: what it does, github.com, checked 2026-11-18.
  9. bubbles: licence, github.com, checked 2026-11-18.
  10. huh: what it does, github.com, checked 2026-11-18.
  11. pterm: what it does, github.com, checked 2026-11-18.
  12. go-prompt: what it does, github.com, checked 2026-11-18.
  13. termbox-go: what it does, github.com, checked 2026-11-18.
  14. progressbar: what it does, github.com, checked 2026-11-18.
  15. glamour: what it does, github.com, checked 2026-11-18.
  16. kingpin: what it does, github.com, checked 2026-11-18.
  17. kong: what it does, github.com, checked 2026-11-18.
  18. kong: subcommands, github.com, checked 2026-11-18.
  19. asciigraph: what it does, github.com, checked 2026-11-18.
  20. termdash: what it does, github.com, checked 2026-11-18.
  21. go-flags: what it does, github.com, checked 2026-11-18.
  22. spinner: what it does, github.com, checked 2026-11-18.
  23. mpb: what it does, github.com, checked 2026-11-18.