cmd

package
v0.0.0-...-716a552 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cli = &cli.Command{
	Name:  "lucy",
	Usage: "The Minecraft server-side package manager",
	Action: tools.Decorate(
		actionEmpty,
		decoratorBaseCommandFlags,
		decoratorGlobalFlags,
		decoratorHelpAndExitOnNoArg,
		decoratorHelpAndExitOnError,
	),
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    flagLogFileName,
			Aliases: []string{"l"},
			Usage:   "Output the path to logfile",
			Value:   false,
		},
		&cli.BoolFlag{
			Name:  flagPrintLogsName,
			Usage: "Print logs to console",
			Value: false,
		},
		&cli.BoolFlag{
			Name:  flagDebugName,
			Usage: "Show debug logs",
			Value: false,
		},
		&cli.BoolFlag{
			Name:   flagDumpLogsName,
			Usage:  "Dump the log history to console before exit",
			Value:  false,
			Hidden: true,
		},
		flagNoStyle,
	},
	Commands: []*cli.Command{
		subcmdStatus,
		subcmdInfo,
		subcmdSearch,
		subcmdAdd,
		subcmdInit,
		subcmdCache,
	},

	EnableShellCompletion:  true,
	Suggest:                true,
	UseShortOptionHandling: true,
	DefaultCommand:         "help",
	OnUsageError:           helpOnUsageError,
}

Cli is the main command for lucy

View Source
var Frontend = "cli"

Frontend should change when user do not run the program in CLI This is prepared for possible GUI implementation

Functions

func CompleteFlagNamesIfRequested

func CompleteFlagNamesIfRequested(cmd *cli.Command) bool

func CompletePackageIDSuggestions

func CompletePackageIDSuggestions(ctx context.Context, cmd *cli.Command, token string)

func ParseCompletionToken

func ParseCompletionToken(token string) (platform, name, version, segment string)

ParseCompletionToken parses a partial "platform/name@version" token for shell completion. Returns parsed components and the active segment ("platform", "name", or "version").

Uses manual string splitting instead of syntax.Parse which panics on partial input.

func PrintCandidates

func PrintCandidates(candidates []CompletionCandidate)

PrintCandidates outputs candidates to stdout in urfave/cli v3 "value:description" format.

func RegisterPackageIDSuggestionProvider

func RegisterPackageIDSuggestionProvider(provider PackageIDSuggestionProvider)

Types

type CompletionCandidate

type CompletionCandidate struct {
	Value       string
	Description string
}

CompletionCandidate holds a value and optional description for shell completion.

func FilterByPrefix

func FilterByPrefix(candidates []CompletionCandidate, prefix string) []CompletionCandidate

FilterByPrefix returns candidates whose Value starts with prefix (case-insensitive).

func StaticPlatformCandidates

func StaticPlatformCandidates() []CompletionCandidate

StaticPlatformCandidates returns completion candidates for all user-facing platforms.

func StaticSortCandidates

func StaticSortCandidates() []CompletionCandidate

StaticSortCandidates returns completion candidates for search sort options.

func StaticSourceCandidates

func StaticSourceCandidates() []CompletionCandidate

StaticSourceCandidates returns completion candidates for concrete upstream sources.

type PackageIDSuggestionContext

type PackageIDSuggestionContext struct {
	Command  string
	Token    string
	Platform string
	Name     string
	Version  string
	Segment  string
}

type PackageIDSuggestionProvider

type PackageIDSuggestionProvider interface {
	Name() string
	Priority() int
	SuggestPackageIDs(context.Context, PackageIDSuggestionContext) ([]CompletionCandidate, error)
}

Jump to

Keyboard shortcuts

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