Skip to content

feat: mapping short flags #1

@mfridman

Description

@mfridman

Map short flags to their long versions (e.g., -f maps to --file). Not sure if we want to do this, but opening this up as it may come up.

Maybe something like this:

root := &cli.Command{
	Flags: cli.FlagsFunc(func(f *flag.FlagSet) {
		f.String("file", "", "path to the tasks file")
	}),
	FlagsMetadata: []cli.FlagMetadata{
		{Name: "file", Required: true, Short: "f"},
	},
}

This would mean all forms would be supported:

-f file.txt
--f file.txt
-file file.txt
--file file.txt

Then, we need to decide on how to render the usage information:

Usage:
  app [command] [flags]

Flags:
  -f, --file string   Path to config file (default "config.yaml")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions