InstallCommand constructor

InstallCommand()

Implementation

InstallCommand() {
  // Add the method option.
  argParser.addOption(
    'method',
    abbr: 'm',
    help: 'The method to use to install the package.',
    valueHelp: 'auto',
    defaultsTo: 'auto',
    allowed: XPM.installMethods.keys,
    allowedHelp: XPM.installMethods,
  );

  // Add the force-method flag.
  argParser.addFlag(
    'force-method',
    negatable: false,
    help:
        'Force the selected method set by --method.'
        '\nIf not set, the selected method can fallback to another method or finally to [any].',
  );

  argParser.addOption('channel', abbr: 'c', help: 'Inform the prefered channel to install the package.');

  // Add the flags option.
  argParser.addMultiOption(
    'flags',
    abbr: 'e',
    help:
        'Inform custom flags to the script.'
        '\nUse this option multiple times to pass multiple flags.'
        '\nExample: --flags="--flag1" --flags="--flag2"',
  );

  argParser.addOption(
    'native',
    abbr: 'n',
    allowed: ['auto', 'only', 'off'],
    defaultsTo: 'auto',
    help: 'Control integration with native package managers.',
  );

  // add verbose flag
  argParser.addFlag('verbose', negatable: false, help: 'Show more information about what is going on.');
}