cli

package
v0.0.0-...-f60fb9d Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRootCommand

func NewRootCommand(cfg *config.Values) *cli.Command

func PrepareArgs

func PrepareArgs(root *cli.Command, args []string) []string

PrepareArgs lets `enter` and `ephemeral` accept distrobox flags after the container name, like the bash distrobox-enter (which only starts the command at -e/--exec/--). urfave's StopOnNthArg can't express this: it stops at the first positional and can't tell the name from the command. So we find the command ourselves and splice a bare "--" in front of it, then let urfave parse the rest. It runs at the entrypoint because urfave has no pre-parse hook.

func ResolveArgs

func ResolveArgs(args []string) []string

ResolveArgs supports v1-style subcommand invocation by basename. v1 shipped separate scripts (distrobox-create, distrobox-enter, …); v2 ships one binary with subcommands.

distrobox                       → no change
distrobox-enter foo             → distrobox enter foo
distrobox-;s                    → distrobox ls

argv[0] is normalised to "distrobox" so help/usage output reads naturally regardless of which symlink was invoked.

Types

type CommandComposer

type CommandComposer[CFG any] struct {
	// contains filtered or unexported fields
}

CommandComposer is a helper for building commands with options. It holds the config, so that options don't need to receive it as an argument.

Jump to

Keyboard shortcuts

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