{{nsFile}}
/*
* This file is autogenerated using the easy-oclif-cli template with ns-flip. Please view
* the instructions for this code base at meta/instructions.md.
*/

{{start imports}}
import {Command, flags} from '@oclif/command'

{{custom customImports}}
{{end imports}}

export default class {{names.singular}} extends Command {
static description = `{{safe specs.description}}
`

static examples = [
{{customStart examples}}
// replace this when you change your command!! To regenerate fresh, first delete everything between the squre brackets.
  `$ {{general.binName}} {{names.singularLowercase}} {{#each specs.args}}sample{{capitalizeFirst name}} {{/each}}{{#each specs.flags}}-{{char}} {{#if (eq type 'string')}}sample{{capitalizeFirst name}} {{/if}}{{/each}}
You have executed the {{names.singularLowercase}} command...
`,
{{customEnd examples}}
]

static flags = {
  help: flags.help({char: 'h'}),
{{#each specs.flags}}
  {{name}}: flags.{{type}}({
    char: '{{char}}',
    description: '{{description}}',{{#if required}}
    required: {{required}},{{/if}}{{#if default}}
    default: '{{default}}',{{/if}}{{#if options}}
    options: [{{#each options}}
      '{{this}}',{{/each}}
    ],{{/if}}{{#if hidden}}
    hidden: {{hidden}},{{/if}}{{#if multiple}}
    multiple: {{multiple}},{{/if}}{{#if env}}
    env: {{env}},{{/if}}{{#if dependsOn}}
    dependsOn: {{dependsOn}},{{/if}}{{#if exclusive}}
    exclusive: {{exclusive}},{{/if}}{{#if parse}}
    parse: {{parse}},{{/if}}
  }),
{{/each}}
}

static args = [
{{#each specs.args}}
  {
    name: '{{name}}',
    description: '{{description}}',{{#if required}}
    required: {{required}},{{/if}}{{#if default}}
    default: '{{default}}',{{/if}}{{#if options}}
    options: [{{#each options}}
      '{{this}}',{{/each}}
    ],{{/if}}{{#if hidden}}
    hidden: {{hidden}},{{/if}}{{#if parse}}
    parse: {{parse}},{{/if}}
  },
{{/each}}
]

async run() {
{{#if (or specs.args specs.flags)}}
  const {{curly true}}{{#if specs.args}}args{{/if}}{{#if (and specs.args specs.flags)}}, {{/if}}{{#if specs.flags}}flags{{/if}}{{curly}} = this.parse({{names.singular}})
{{/if}}{{#if specs.args}}
  const {{curly true}}{{#each specs.args}}{{#if @first}}{{name}}{{/if}}{{#if (not @first)}}, {{name}}{{/if}}{{/each}}{{curly}} = args
{{/if}}{{#if specs.flags}}
  const {{curly true}}{{#each specs.flags}}{{#if @first}}{{name}}{{/if}}{{#if (not @first)}}, {{name}}{{/if}}{{/each}}{{curly}} = flags
{{/if}}
  {{customStart run}}
  // Put your custom code here...
{{#if specs.args}}  Object.keys(args).map((argName: string) => {
    if (args[argName] === 'sampleBadArgValue')
      throw new Error(`bad arg value '${args[argName]}' for arg '${argName}'`)
    return argName
  }){{/if}}
  this.log(`You have executed the {{names.singularLowercase}} command.
{{#if specs.args}}
  Here are the args you used: {{#each specs.args}}
    {{name}}: ${{curly true}}{{name}}{{curly}}{{/each}}
{{/if}}
{{#if specs.flags}}
  Here are the flags you used: {{#each specs.flags}}
    {{name}}: ${{curly true}}{{name}}{{curly}}{{/each}}

{{/if}}
Learn how to modify the generated code here: https://ns-flip.nostack.net/Safe-Custom-Code.`)
  {{customEnd run}}
}
}
