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

fix: Handle empty/white space project and channel names #107

Merged
merged 3 commits into from
Nov 22, 2022

Conversation

kruti49
Copy link
Collaborator

@kruti49 kruti49 commented Nov 8, 2022

Handle empty/white space project names and channels

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`,
Copy link
Collaborator

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.

@@ -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')
Copy link
Collaborator

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.

@@ -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'))
Copy link
Collaborator

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.

@grof grof changed the title fix: empty/white space project names & channels fix: Handle empty/white space project and channel names Nov 22, 2022
@grof grof merged commit 6742b3c into beta Nov 22, 2022
@grof grof deleted the fix/empty-white-space branch November 22, 2022 22:03
@grof
Copy link
Collaborator

grof commented Jan 24, 2023

🎉 This PR is included in version 2.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@grof grof added the released label Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants