MCPcopy
hub / github.com/charmbracelet/fang

github.com/charmbracelet/fang @v2.0.1 sqlite

repository ↗ · DeepWiki ↗ · release v2.0.1 ↗
49 symbols 105 edges 9 files 24 documented · 49%
README

Fang

<img width="485" alt="Charm Fang" src="https://github.com/user-attachments/assets/3f34ea01-3750-4760-beb2-a1b700e110f5">






<a href="https://github.com/charmbracelet/fang/releases"><img src="https://img.shields.io/github/release/charmbracelet/fang.svg" alt="Latest Release"></a>
<a href="https://pkg.go.dev/github.com/charmbracelet/fang?tab=doc"><img src="https://godoc.org/github.com/charmbracelet/fang?status.svg" alt="GoDoc"></a>
<a href="https://github.com/charmbracelet/fang/actions"><img src="https://github.com/charmbracelet/fang/workflows/build/badge.svg" alt="Build Status"></a>

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

<img width="859" alt="The Charm Fang mascot and title treatment" src="https://github.com/user-attachments/assets/5c35e1fa-9577-4f81-a879-3ddb4d4a43f0" />

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 mango[^1]
  • 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)

[^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.

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

Extension points exported contracts — how you extend this code

Option (FuncType)
Option changes fang settings.
fang.go

Core symbols most depended-on inside this repo

isUsageError
called by 3
help.go
styleUsage
called by 2
help.go
renderGroup
called by 2
help.go
mustColorscheme
called by 2
theme.go
makeStyles
called by 2
theme.go
helpFn
called by 1
help.go
writeLongShort
called by 1
help.go
styleExamples
called by 1
help.go

Shape

Function 43
Struct 5
FuncType 1

Languages

Go100%

Modules by API surface

help.go14 symbols
fang.go14 symbols
theme.go10 symbols
fang_test.go6 symbols
theme_test.go1 symbols
fang_windows.go1 symbols
fang_other.go1 symbols
example/main.go1 symbols
error_test.go1 symbols

Dependencies from manifests, versioned

charm.land/lipgloss/v2v2.0.1 · 1×
github.com/aymanbagabas/go-udiffv0.4.1 · 1×
github.com/charmbracelet/colorprofilev0.4.2 · 1×
github.com/charmbracelet/ultravioletv0.0.0-2026020511310 · 1×
github.com/charmbracelet/x/ansiv0.11.6 · 1×
github.com/charmbracelet/x/exp/charmtonev0.0.0-2025060320142 · 1×
github.com/charmbracelet/x/exp/goldenv0.0.0-2025080622240 · 1×
github.com/charmbracelet/x/termv0.2.2 · 1×
github.com/charmbracelet/x/termiosv0.1.1 · 1×
github.com/charmbracelet/x/windowsv0.2.2 · 1×
github.com/clipperhouse/displaywidthv0.11.0 · 1×
github.com/clipperhouse/uax29/v2v2.7.0 · 1×

For agents

$ claude mcp add fang \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact