cll

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package cll provides utilities for building CLI applications with urfave/cli/v3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvWithPrefix

func EnvWithPrefix(prefix string) func(strs ...string) cli.ValueSourceChain

EnvWithPrefix returns a function that creates environment variable sources with a consistent prefix. This is useful for namespacing all environment variables for an application.

Example:

env := cll.EnvWithPrefix("MYAPP_")
flag := &cli.StringFlag{
	Name:    "config",
	Sources: env("CONFIG", "CONFIG_PATH"), // reads MYAPP_CONFIG, MYAPP_CONFIG_PATH
}

func Register

func Register(root *cli.Command, subs ...Registerable) *cli.Command

Register chains multiple Registerable implementations onto a root command. Each Registerable is applied in order, allowing modular composition of CLI structure.

Example:

root := &cli.Command{Name: "app"}
root = cll.Register(root, generateCmd, brewCmd, runCmd)

Types

type Registerable

type Registerable interface {
	Register(*cli.Command) *cli.Command
}

Registerable defines a type that can register itself with a CLI command. Implementations typically add subcommands, flags, or other modifications to the provided root command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL