How to use the clipanion.Command.Rest function in clipanion

To help you get started, we’ve selected a few clipanion examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yarnpkg / berry / packages / plugin-essentials / sources / commands / add.ts View on Github external
import {BaseCommand, WorkspaceRequiredError}                        from '@yarnpkg/cli';
import {Cache, Configuration, Descriptor, LightReport, MessageName} from '@yarnpkg/core';
import {Project, StreamReport, Workspace, Ident}                    from '@yarnpkg/core';
import {structUtils}                                                from '@yarnpkg/core';
import {PortablePath}                                               from '@yarnpkg/fslib';
import {Command, UsageError}                                        from 'clipanion';
import inquirer                                                     from 'inquirer';

import * as suggestUtils                                            from '../suggestUtils';
import {Hooks}                                                      from '..';

// eslint-disable-next-line arca/no-default-export
export default class AddCommand extends BaseCommand {
  @Command.Rest()
  packages: Array = [];

  @Command.Boolean(`--json`)
  json: boolean = false;

  @Command.Boolean(`-E,--exact`)
  exact: boolean = false;

  @Command.Boolean(`-T,--tilde`)
  tilde: boolean = false;

  @Command.Boolean(`-D,--dev`)
  dev: boolean = false;

  @Command.Boolean(`-P,--peer`)
  peer: boolean = false;
github yarnpkg / berry / packages / plugin-essentials / sources / commands / remove.ts View on Github external
import {BaseCommand, WorkspaceRequiredError}       from '@berry/cli';
import {Configuration, Cache, Descriptor, Project} from '@berry/core';
import {StreamReport, Workspace}                   from '@berry/core';
import {structUtils}                               from '@berry/core';
import {Command, UsageError}                       from 'clipanion';

import * as suggestUtils                           from '../suggestUtils';
import {Hooks}                                     from '..';

// eslint-disable-next-line arca/no-default-export
export default class RemoveCommand extends BaseCommand {
  @Command.Boolean(`-A,--all`)
  all: boolean = false;

  @Command.Rest()
  names: Array = [];

  static usage = Command.Usage({
    description: `remove dependencies from the project`,
    details: `
      This command will remove the specified packages from the current workspace.

      If the \`-A,--all\` option is set, the operation will be applied to all workspaces from the current project.
    `,
    examples: [[
      `Remove a dependency from the current project`,
      `yarn remove lodash`,
    ], [
      `Remove a dependency from all workspaces at once`,
      `yarn remove lodash --all`,
    ]],
github yarnpkg / berry / packages / plugin-pnp / sources / commands / unplug.ts View on Github external
import {BaseCommand, WorkspaceRequiredError}         from '@yarnpkg/cli';
import {Cache, Configuration, Project, StreamReport} from '@yarnpkg/core';
import {structUtils}                                 from '@yarnpkg/core';
import {Command}                                     from 'clipanion';

// eslint-disable-next-line arca/no-default-export
export default class UnplugCommand extends BaseCommand {
  @Command.Rest()
  patterns: Array = [];

  static usage = Command.Usage({
    description: `force the unpacking of a list of packages`,
    details: `
      This command will add the specified selectors to the list of packages that must be unplugged when installed.

      A package being unplugged means that instead of being referenced directly through its archive, it will be unpacked at install time in the directory configured via \`virtualFolder\`.

      Unpacking a package isn't advised as a general tool because it makes it harder to store your packages within the repository. However, it's a good approach to quickly and safely debug some packages, and can even sometimes be required depending on the context (for example when the package contains shellscripts).

      The unplug command sets a flag that's persisted in your top-level \`package.json\` through the \`dependenciesMeta\` field. As such, to undo its effects, just revert the changes made to the manifest and run \`yarn install\`.
    `,
    examples: [[
      `Unplug lodash`,
      `yarn unplug lodash`,
github yarnpkg / berry / packages / plugin-essentials / sources / commands / up.ts View on Github external
import {BaseCommand, WorkspaceRequiredError}                        from '@yarnpkg/cli';
import {Cache, Configuration, Descriptor, LightReport, MessageName} from '@yarnpkg/core';
import {Project, StreamReport, Workspace}                           from '@yarnpkg/core';
import {structUtils}                                                from '@yarnpkg/core';
import {Command, UsageError}                                        from 'clipanion';
import inquirer                                                     from 'inquirer';

import * as suggestUtils                                            from '../suggestUtils';
import {Hooks}                                                      from '..';

// eslint-disable-next-line arca/no-default-export
export default class UpCommand extends BaseCommand {
  @Command.Rest()
  packages: Array = [];

  @Command.Boolean(`-i,--interactive`)
  interactive: boolean = false;

  @Command.Boolean(`-v,--verbose`)
  verbose: boolean = false;

  @Command.Boolean(`-E,--exact`)
  exact: boolean = false;

  @Command.Boolean(`-T,--tilde`)
  tilde: boolean = false;

  static usage = Command.Usage({
    description: `upgrade dependencies across the project`,

clipanion

Type-safe CLI library / framework with no runtime dependencies

MIT
Latest version published 2 months ago

Package Health Score

83 / 100
Full package analysis