Documentation
    Preparing search index...

    Variable flagsConst

    flags: {
        string<Type = string>(
            options?: Partial<Omit<StringFlag<Type>, "type">>,
        ): <Key extends string, Target extends { [K in string]?: Type }>(
            target: Target,
            propertyName: Key,
        ) => void;
        boolean<Type = boolean>(
            options?: Partial<Omit<BooleanFlag<Type>, "type">>,
        ): <Key extends string, Target extends { [K in string]?: Type }>(
            target: Target,
            propertyName: Key,
        ) => void;
        number<Type = number>(
            options?: Partial<Omit<NumberFlag<Type>, "type">>,
        ): <Key extends string, Target extends { [K in string]?: Type }>(
            target: Target,
            propertyName: Key,
        ) => void;
        array<Type extends any[] = string[]>(
            options?: Partial<Omit<ArrayFlag<Type>, "type">>,
        ): <Key extends string, Target extends { [K in string]?: Type }>(
            target: Target,
            propertyName: Key,
        ) => void;
    } = ...

    Namespace for defining flags using decorators.

    Flags are named options that commands can accept from the CLI. They can be passed using --flag-name or -alias syntax and are made available as properties on the command instance.

    Type Declaration

    • string: function
      • Define flag that accepts a string value

        Type Parameters

        • Type = string

        Parameters

        • Optionaloptions: Partial<Omit<StringFlag<Type>, "type">>

          Configuration options for the string flag

        Returns <Key extends string, Target extends { [K in string]?: Type }>(
            target: Target,
            propertyName: Key,
        ) => void

        export class MakeCommand extends BaseCommand {
        @flags.string({ description: 'Database connection name', alias: 'c' })
        declare connection?: string

        @flags.string({ description: 'Template name', required: true, default: 'default' })
        declare template: string
        }
        // Usage: node ace make --connection=mysql --template=api
        // Usage: node ace make -c mysql --template=api
    • boolean: function
      • Define flag that accepts a boolean value

        Boolean flags don't require a value - their presence indicates true. They can optionally support negated variants with --no-flag-name.

        Type Parameters

        • Type = boolean

        Parameters

        • Optionaloptions: Partial<Omit<BooleanFlag<Type>, "type">>

          Configuration options for the boolean flag

        Returns <Key extends string, Target extends { [K in string]?: Type }>(
            target: Target,
            propertyName: Key,
        ) => void

        export class MigrateCommand extends BaseCommand {
        @flags.boolean({ description: 'Skip confirmation prompts', alias: 'f' })
        declare force: boolean

        @flags.boolean({ description: 'Run in dry mode', showNegatedVariantInHelp: true })
        declare dryRun: boolean
        }
        // Usage: node ace migrate --force
        // Usage: node ace migrate -f
        // Usage: node ace migrate --dry-run or --no-dry-run
    • number: function
      • Define flag that accepts a numeric value

        Type Parameters

        • Type = number

        Parameters

        • Optionaloptions: Partial<Omit<NumberFlag<Type>, "type">>

          Configuration options for the number flag

        Returns <Key extends string, Target extends { [K in string]?: Type }>(
            target: Target,
            propertyName: Key,
        ) => void

        export class ServeCommand extends BaseCommand {
        @flags.number({ description: 'Port number', alias: 'p', default: 3000 })
        declare port: number

        @flags.number({ description: 'Number of workers', required: false })
        declare workers?: number
        }
        // Usage: node ace serve --port=8080
        // Usage: node ace serve -p 8080 --workers=4
    • array: function
      • Define flag that accepts an array of values

        Array flags can be specified multiple times to build up an array of values.

        Type Parameters

        • Type extends any[] = string[]

        Parameters

        • Optionaloptions: Partial<Omit<ArrayFlag<Type>, "type">>

          Configuration options for the array flag

        Returns <Key extends string, Target extends { [K in string]?: Type }>(
            target: Target,
            propertyName: Key,
        ) => void

        export class BuildCommand extends BaseCommand {
        @flags.array({ description: 'Include additional files' })
        declare include?: string[]

        @flags.array({ description: 'Environment variables', alias: 'e' })
        declare env?: string[]
        }
        // Usage: node ace build --include=*.js --include=*.css
        // Usage: node ace build -e NODE_ENV=production -e DEBUG=false
        // Results: include = ['*.js', '*.css'], env = ['NODE_ENV=production', 'DEBUG=false']
    export class MakeCommand extends BaseCommand {
    @flags.boolean({ description: 'Skip confirmation prompts' })
    declare force: boolean

    @flags.string({ description: 'Database connection', alias: 'c' })
    declare connection?: string

    @flags.array({ description: 'Additional tags' })
    declare tags?: string[]
    }