Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mapping short flags #1

Open
mfridman opened this issue Dec 31, 2024 · 0 comments
Open

feat: mapping short flags #1

mfridman opened this issue Dec 31, 2024 · 0 comments

Comments

@mfridman
Copy link
Owner

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")
@mfridman mfridman changed the title Add support for mapping short flags feat: mapping short flags Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant