Go MIT

fang

The CLI starter kit

C

charmbracelet

Dernière activité 4 mai 2026
charmbracelet/fang

2 k

étoiles

48

forks

25

issues ouvertes

Ce README est souvent en anglais.

Fang

Charm Fang

Latest Release GoDoc Build Status

The CLI starter kit. A small, experimental library for batteries-included Cobra applications.

The Charm Fang mascot and title treatment

Features

  • Fancy output: fully styled help and usage pages
  • Fancy errors: fully styled errors
  • Automatic --version: set it to the build info, or a version of your choice
  • Manpages: Adds a hidden man command to generate manpages using mango1
  • Completions: Adds a completion command to generate shell completions
  • Themeable: use the built-in theme, or make your own
  • UX: Silent usage output (help is not shown after a user error)

Usage

To use it, invoke fang.Execute passing your root *cobra.Command:

package main

import (
	"context"
	"os"

	"github.com/charmbracelet/fang"
	"github.com/spf13/cobra"
)

func main() {
	cmd := &cobra.Command{
		Use:   "example",
		Short: "A simple example program!",
	}
	if err := fang.Execute(context.Background(), cmd); err != nil {
		os.Exit(1)
	}
}

That's all there is to it!

Contributing

See contributing.

Feedback

We’d love to hear your thoughts on this project. Feel free to drop us a note!

License

MIT


Part of Charm.

The Charm logo

Charm热爱开源 • Charm loves open source

Footnotes

  1. Default cobra man pages generates one man page for each command. This is generally fine for programs with a lot of sub commands, like git, but its an overkill for smaller programs. Mango also uses roff directly instead of converting from markdown, so it should render better looking man pages. ↩

Projets similaires

A tool for glamorous shell scripts 🎀

Gobashshell
Ccharmbracelet
24,4 k étoiles553

A declarative, simple, fast, and fun package for building command line tools in Go

Goclicommand-linego
Uurfave
24,3 k étoiles1,8 k

A Commander for modern Go CLI interactions

Goclicli-appcobra
Sspf13
44,7 k étoiles4,5 k