Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UpgradeInteractiveCommand

Hierarchy

  • BaseCommand
    • UpgradeInteractiveCommand

Properties

cli

cli: MiniCli<CommandContext>

Predefined variable that will be populated with a miniature API that can be used to query Clipanion and forward commands.

context

Predefined variable that will be populated with the context of the application.

help

help: boolean

Predefined that will be set to true if -h,--help has been used, in which case Command#execute shouldn't be called.

path

path: string[]

The path that got used to access the command being executed.

Static Entries

Entries: object

A list of useful semi-opinionated command entries that have to be registered manually.

They cover the basic needs of most CLIs (e.g. help command, version command).

They cover the basic needs of most CLIs (e.g. help command, version command).

example

cli.register(Command.Entries.Help); cli.register(Command.Entries.Version);

Type declaration

  • Help: typeof HelpCommand

    A command that prints the usage of all commands.

    Paths: -h, --help

    Paths: -h, --help

  • Version: typeof VersionCommand

    A command that prints the version of the binary (cli.binaryVersion).

    Paths: -v, --version

    Paths: -v, --version

Static Optional schema

schema: Schema<any>

The schema used to validate the Command instance.

Static usage

usage: Usage = Command.Usage({category: `Interactive commands`,description: `open the upgrade interface`,details: `This command opens a fullscreen terminal interface where you can see the packages used by your application, their status compared to the latest versions available on the remote registry, and let you upgrade.`,examples: [[`Open the upgrade window`,`yarn upgrade-interactive`,]],})

Methods

execute

  • execute(): Promise<0 | 1>

validateAndExecute

  • validateAndExecute(): Promise<number>

Static Array

  • Array(descriptor: string, __namedParameters?: object): function
  • Register a listener that looks for an option and its followup argument. When Clipanion detects that this argument is present, the value will be pushed into the array represented in the property.

    Parameters

    • descriptor: string
    • Optional __namedParameters: object
      • hidden: undefined | false | true

    Returns function

      • <Context>(prototype: Command<Context>, propertyName: string): void
      • Type parameters

        • Context: BaseContext

        Parameters

        • prototype: Command<Context>
        • propertyName: string

        Returns void

Static Boolean

  • Boolean(descriptor: string, __namedParameters?: object): function
  • Register a boolean listener for the given option names. When Clipanion detects that this argument is present, the value will be set to false. The value won't be set unless the option is found, so you must remember to set it to an appropriate default value.

    Parameters

    • descriptor: string

      the option names.

    • Optional __namedParameters: object
      • hidden: undefined | false | true

    Returns function

      • <Context>(prototype: Command<Context>, propertyName: string): void
      • Type parameters

        • Context: BaseContext

        Parameters

        • prototype: Command<Context>
        • propertyName: string

        Returns void

Static Path

  • Path(...path: string[]): function
  • Wrap the specified command to be attached to the given path on the command line. The first path thus attached will be considered the "main" one, and all others will be aliases.

    Parameters

    • Rest ...path: string[]

      The command path.

    Returns function

      • <Context>(prototype: Command<Context>, propertyName: string): void
      • Type parameters

        • Context: BaseContext

        Parameters

        • prototype: Command<Context>
        • propertyName: string

        Returns void

Static Proxy

  • Proxy(__namedParameters?: object): function
  • Register a listener that takes all the arguments remaining (including options and such) and store them into the selected property. Note that all methods affecting positional arguments are evaluated in the definition order; don't mess with it (for example sorting your properties in ascendent order might have adverse results).

    Parameters

    • Optional __namedParameters: object
      • required: undefined | number

    Returns function

      • <Context>(prototype: Command<Context>, propertyName: string): void
      • Type parameters

        • Context: BaseContext

        Parameters

        • prototype: Command<Context>
        • propertyName: string

        Returns void

Static Rest

  • Rest(): PropertyDecorator
  • Rest(opts: object): PropertyDecorator
  • Register a listener that takes all the positional arguments remaining and store them into the selected property. Note that all methods affecting positional arguments are evaluated in the definition order; don't mess with it (for example sorting your properties in ascendent order might have adverse results).

    Returns PropertyDecorator

  • Register a listener that takes all the positional arguments remaining and store them into the selected property. Note that all methods affecting positional arguments are evaluated in the definition order; don't mess with it (for example sorting your properties in ascendent order might have adverse results).

    Parameters

    • opts: object
      • required: number

        The minimal number of arguments required for the command to be successful.

    Returns PropertyDecorator

Static Schema

Static String

  • String(descriptor: string, opts?: undefined | object): PropertyDecorator
  • String(descriptor?: undefined | object): PropertyDecorator
  • Register a listener that looks for an option and its followup argument. When Clipanion detects that this argument is present, the value will be set to whatever follows the option in the input. The value won't be set unless the option is found, so you must remember to set it to an appropriate default value. Note that all methods affecting positional arguments are evaluated in the definition order; don't mess with it (for example sorting your properties in ascendent order might have adverse results).

    Parameters

    • descriptor: string

      The option names.

    • Optional opts: undefined | object

    Returns PropertyDecorator

  • Register a listener that looks for positional arguments. When Clipanion detects that an argument isn't an option, it will put it in this property and continue processing the rest of the command line. Note that all methods affecting positional arguments are evaluated in the definition order; don't mess with it (for example sorting your properties in ascendent order might have adverse results).

    Parameters

    • Optional descriptor: undefined | object

      Whether or not filling the positional argument is required for the command to be a valid selection.

    Returns PropertyDecorator

Static Usage

Static addOption

  • addOption<Context>(name: string, builder: function): void

Static addPath

  • addPath(...path: string[]): void

Static getMeta

  • getMeta<Context>(prototype: Command<Context>): Meta<Context>

Static resolveMeta

  • resolveMeta<Context>(prototype: Command<Context>): Meta<Context>

Generated using TypeDoc