Skip to content

Commit

Permalink
fix: wrap flags with hyphens with quotes (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley authored Sep 13, 2022
1 parent 1c8d020 commit 0c4b42d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commands/dev/generate/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ export default class DevGenerateFlag extends SfCommand<void> {
await this.updateMarkdownFile(answers, standardizedCommandId);

exec(`yarn prettier --write ${commandFilePath}.ts`);

exec('yarn compile');

this.log(`Added ${answers.name} flag to ${commandFilePath}.ts`);
}

Expand Down Expand Up @@ -398,7 +401,9 @@ export default class DevGenerateFlag extends SfCommand<void> {
if (answers.integerDefault && answers.multiple) flagOptions.push(`default: [${answers.integerDefault}]`);
if (answers.type === 'enum') flagOptions.push('options: []');

const newFlag = ` ${answers.name}: Flags.${answers.type}({
const flagName = answers.name.includes('-') ? `'${answers.name}'` : answers.name;

const newFlag = ` ${flagName}: Flags.${answers.type}({
${flagOptions.join(',\n ')},
}),`.split('\n');

Expand Down

0 comments on commit 0c4b42d

Please sign in to comment.