-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: Handle empty/white space project and channel names #107
Conversation
src/utils/validations.ts
Outdated
debug('validateChannelName()') | ||
if (name.trim().length === 0) { | ||
throw (eInvalidValue("Channel name can't be empty or consist only of whitespace.", [ | ||
'Supply a non-empty value to --name flag', | ||
`Supply a non-empty value to ${optionName} flag`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to:
Supply a non-empty value to flag '${optionName}
to be consistent with the other validation messages (lines 45-86). I see other validation messages diverged from that. I will open a separate issue for that.
src/commands/channels/create.ts
Outdated
@@ -83,7 +83,7 @@ the command currently requires that both the | |||
tryDomainOptionsValidation(options: any, domainOptions: DomainOption[]) { | |||
super.tryDomainOptionsValidation(options, domainOptions) | |||
|
|||
validateChannelName(options.name) | |||
validateChannelName(options.name, '--name') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's pass the name of the flag without the "--". Also applies to line 54 below.
src/commands/projects/create.ts
Outdated
@@ -153,6 +153,10 @@ provide a description of your project using the --description flag.` | |||
const modes = asArray(options.modes) | |||
this.validateChannelsAndModes(channels, modes) | |||
|
|||
for (const channel of channels) { | |||
validateChannelName(channel, '-' + (MixFlags.channelMultipleFlag.char?.toString() || 'flag')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get rid of the "-". It actually looks like two hyphens that got auto-corrected to an en dash.
🎉 This PR is included in version 2.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Handle empty/white space project names and channels