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

Rename alias option to shortFlag #109

Closed
sindresorhus opened this issue Jan 11, 2019 · 7 comments · Fixed by #225
Closed

Rename alias option to shortFlag #109

sindresorhus opened this issue Jan 11, 2019 · 7 comments · Fixed by #225

Comments

@sindresorhus
Copy link
Owner

I never liked the alias wording, which was inherited from minimist. I think it would be better to have a more explicit and semantic name called shortFlag.

We could then also add a aliases option where users can specify actual aliases and not just limited to one:

{
	flags: {
		unicorn: {
			type: 'string',
			default: 'love',
			shortFlag: 'u',
			aliases: [
				'--rainbow',
				'-r'
			]
		}
	}
}

Could use some feedback on this proposal.

@sindresorhus sindresorhus added this to the 6.0.0 milestone Jan 11, 2019
@jenbuzz
Copy link

jenbuzz commented Jan 11, 2019

Why not just "short"?

@sindresorhus
Copy link
Owner Author

I think short can be ambiguous. It's clear in this issue description, but not so much if you just read the code without knowing the context behind it.

@LitoMore
Copy link
Contributor

I think the shortFlag is redundant, only aliases just be fine.

{
	flags: {
		unicorn: {
			aliases: ['-u']
		}
	}
}

// same with

{
	flags: {
		unicorn: {
			shortFlag: 'u'
		}
	}
}

@sindresorhus
Copy link
Owner Author

@LitoMore It's not. shortFlag is there to semantically indicate what's the short version of the flag. aliases is just any kind of alias long/short/medium/thin/thick/unicorny. This distinction will be especially important when we start generating the help output.

@LitoMore
Copy link
Contributor

shortFlag is there to semantically indicate what's the short version of the flag. aliases is just any kind of alias long/short/medium/thin/thick/unicorny. This distinction will be especially important when we start generating the help output.

Good point. I agree.

@benfletcher
Copy link

benfletcher commented Dec 10, 2019

{
	options: [
		{
			flags: ['unicorn', 'u'],
			type: 'string',
			default: 'love',
		},
		{
			flags: ['force', 'f'],
			type: 'boolean',
		},
	}
}

This flattens the structure and eliminates a need entirely for a second term altogether. 'Options' is a little confusing here, admittedly, since it lives inside the Meow options object. I propose that word however, to be consistent with CLI terminology: a CLI has arguments and options. Options are specified by 'flags'.

@sindresorhus
Copy link
Owner Author

@BendingBender That would be a big breaking change and IMHO not for the better. I also want to make a clear distinction between an alias and a short-flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants