How to use the @oclif/command.flags.help function in @oclif/command

To help you get started, we’ve selected a few @oclif/command 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 celo-org / celo-monorepo / packages / cli / src / base.ts View on Github external
import { ContractKit, newKitFromWeb3 } from '@celo/contractkit'
import { CeloProvider } from '@celo/contractkit/lib/providers/celo-provider'
import { Command, flags } from '@oclif/command'
import { ParserOutput } from '@oclif/parser/lib/parse'
import Web3 from 'web3'
import { getNodeUrl } from './utils/config'
import { injectDebugProvider } from './utils/eth-debug-provider'
import { requireNodeIsSynced } from './utils/helpers'

// Base for commands that do not need web3.
export abstract class LocalCommand extends Command {
  static flags = {
    logLevel: flags.string({ char: 'l', hidden: true }),
    help: flags.help({ char: 'h', hidden: true }),
    truncate: flags.boolean({
      default: true,
      hidden: true,
      allowNo: true,
      description: 'Truncate fields to fit line',
    }),
  }

  // TODO(yorke): implement log(msg) switch on logLevel with chalk colored output
  log(msg: string, logLevel: string = 'info') {
    if (logLevel === 'info') {
      console.debug(msg)
    } else if (logLevel === 'error') {
      console.error(msg)
    }
  }
github pharindoko / json-serverless / packages / cli / src / commands / deploy.ts View on Github external
import {Command, flags} from '@oclif/command'
import Listr = require('listr');
import { AppConfig } from 'json-serverless-lib';
import * as child from 'child_process';
import * as path from 'path'; 
import fs from 'fs';
export class Deploy extends Command {
  static description = 'describe the command here'

  static flags = {
    help: flags.help({char: 'h'}),
    // flag with no value (-f, --force)
    name: flags.string({
      char: 'n',                    // shorter flag version
      description: 'name of the api/stack', // help description for flag
      hidden: false,                // hide from help
      multiple: false,              // allow setting this flag multiple times
      default: 'json-serverless',             // default value if flag not passed (can be a function that returns a string or undefined)
      required: true,              // make flag required (this is not common and you should probably use an argument instead)
    }),
    readonly: flags.boolean({
      char: 'r',                    // shorter flag version
      description: 'set api to readonly (true) or writeable (false)', // help description for flag
      hidden: false,                // hide from help
      default: false,             // default value if flag not passed (can be a function that returns a string or undefined)
      required: false,             // default value if flag not passed (can be a function that returns a string or undefined)
    }),
github SakkuCloud / sakku-cli / src / commands / app / col.ts View on Github external
import cli from 'cli-ux';
import * as inquirer from 'inquirer';

// Project Modules
import { appService } from '../../_service/app.service';

export default class Col extends Command {
  static description = 'add new collaborators, as well ad showing the list of collaborators';

  static examples = [
    `$ sakku app:col`,
    `$ sakku app:col -a`
  ];

  static flags = {
    help: flags.help({ char: 'h' }),
    add: flags.boolean({ char: 'a', exclusive: ['edit', 'delete'] }),
    edit: flags.boolean({ char: 'e', exclusive: ['add', 'delete'] }),
    delete: flags.boolean({ char: 'e', exclusive: ['add', 'edit'] }),
  };

  static args = [
    {
      name: 'app',
      required: false,
      description: 'app id/name',
      hidden: false
    },
  ];

  async run() {
    const { args, flags } = this.parse(Col);
github hasura / graphqurl / src / index.js View on Github external
https://my-graphql-endpoint/graphql \\
  -H 'Authorization: token ' \\
  -H 'X-Another-Header: another-header-value' \\
  -v 'variable1=value1' \\
  -v 'variable2=value2' \\
  -q 'query { table { column } }'
`;

GraphqurlCommand.usage = 'ENDPOINT [-q QUERY]';

GraphqurlCommand.flags = {
  // add --version flag to show CLI version
  version: flags.version(),

  // add --help flag to show CLI version
  help: flags.help({char: 'h'}),

  // query for graphql
  query: flags.string({
    char: 'q',
    description: 'graphql query to execute',
  }),

  // headers, comma separated if they are many
  header: flags.string({
    char: 'H',
    description: 'request header',
    multiple: true,
  }),

  // variables for the query
  variable: flags.string({
github rucken / cli / src / commands / nestjs-new.ts View on Github external
import { flags, Command } from '@oclif/command';
import { resolve as resolvePath, sep } from 'path';
const npmRun = require('npm-run');

export class NestJSNew extends Command {
  static aliases = ['new:nestjs', 'nestjs-new'];
  static description = 'generate empty NestJS backend application';
  static flags = {
    help: flags.help({ char: 'h' }),
    name: flags.string({ char: 'n', description: 'application name on ke-bab case' }),
    username: flags.string({ char: 'u', description: 'username' }),
    email: flags.string({ char: 'e', description: 'email' })
  };
  static args = [{ name: 'folder' }];
  async run() {
    const { args, flags } = this.parse(NestJSNew);
    const folder = args.folder;
    const name = flags.name;
    const username = flags.username;
    const email = flags.email;

    try {
      await this.runNew(
        folder,
        name,
github sharedstreets / sharedstreets-js / src / commands / view.ts View on Github external
const chalk = require('chalk');

const Path = require('path');
const Hapi = require('hapi');
const Inert = require('@hapi/inert');


export default class View extends Command {
  static description = 'tools for viewing SharedStreets data sets'

  static examples = [
    `$$$`
  ]

  static flags = {
    help: flags.help({char: 'h'})
  }

  static args = [{name: 'dir'}]

  async run() {
    const {args, flags} = this.parse(View);

    server(args.dir);
  } 
}

class EventDataRequest {
 
    weeks:string[];
    typeFilter:string[];
    periodFilter:number[];
github badassery / laravel-up / src / commands / configure.ts View on Github external
import Listr from "listr";
import {
  displayCommandHeader,
  promptEnvironment,
  publishEnvironment,
  testTargetDirectory
} from "../actions";
import { execAsync } from "../providers/execAsync";
import TargetDirectoryCommand from "./target-directory-command";

export default class Configure extends TargetDirectoryCommand {
  static description =
    "Configures an existing vanilla Laravel app as an Up project";

  static flags = {
    help: flags.help({ char: "h" })
  };

  static args = TargetDirectoryCommand.combineArgs([]);

  async run() {
    const { args } = this.parse(Configure);

    displayCommandHeader(
      "This will guide you through configuration of an existing vanilla Laravel application to be used as an Up project"
    );

    let directory = args.directory;

    if (!directory) {
      const mainPrompt = await inquirer.prompt([
        {
github vmarchaud / servicectl / src / cli / create.ts View on Github external
import { Command, flags } from '@oclif/command'
import { ServiceAPI } from '../api'
import { cli } from 'cli-ux'
import * as path from 'path'
import ListCommand from './list'
import { ServiceMode } from '../types/service'
import {
  ServiceCreatePermissionMode,
  EnvironmentEntry
} from '../types/serviceBackend'

export default class CreateCommand extends Command {
  static description = 'register your application to the init system and run it'

  static flags = {
    help: flags.help({ char: 'h' }),
    interpreter: flags.string({
      description: 'interpreter to use when launching your script (either binary name or absolute path to it)'
    }),
    as: flags.string({
      description: 'Choose permission to assign to the service (either user (default), nobody or root)'
    }),
    instances: flags.integer({
      description: 'Choose how many instances of the service will be launched'
    }),
    port: flags.integer({
      description: 'If using cluster mode, on which port you want the cluster to listen'
    }),
    name: flags.string({
      description: 'Choose a custom name of your service'
    }),
    'import-env': flags.boolean({
github che-incubator / chectl / src / commands / server / start.ts View on Github external
import * as Listr from 'listr'
import * as notifier from 'node-notifier'
import * as path from 'path'

import { cheDeployment, cheNamespace, listrRenderer } from '../../common-flags'
import { DEFAULT_CHE_IMAGE, DEFAULT_CHE_OPERATOR_IMAGE } from '../../constants'
import { CheTasks } from '../../tasks/che'
import { InstallerTasks } from '../../tasks/installers/installer'
import { K8sTasks } from '../../tasks/platforms/k8s'
import { PlatformTasks } from '../../tasks/platforms/platform'

export default class Start extends Command {
  static description = 'start Eclipse Che Server'

  static flags = {
    help: flags.help({ char: 'h' }),
    chenamespace: cheNamespace,
    'listr-renderer': listrRenderer,
    'deployment-name': cheDeployment,
    cheimage: string({
      char: 'i',
      description: 'Che server container image',
      default: DEFAULT_CHE_IMAGE,
      env: 'CHE_CONTAINER_IMAGE'
    }),
    templates: string({
      char: 't',
      description: 'Path to the templates folder',
      default: Start.getTemplatesDir(),
      env: 'CHE_TEMPLATES_FOLDER'
    }),
    'devfile-registry-url': string({
github muenzpraeger / create-lwc-app / packages / lwc-services / src / commands / serve.ts View on Github external
const compression = require('compression')
const helmet = require('helmet')
const express = require('express')

import { lwcConfig } from '../config/lwcConfig'
import { messages } from '../messages/serve'
import { log, welcome } from '../utils/logger'

export default class Serve extends Command {
    static description = messages.description

    static examples = messages.help.examples

    static flags = {
        help: flags.help({ char: 'h' }),
        directory: flags.string({
            char: 'd',
            description: messages.flags.directory,
            default: lwcConfig.buildDir
        }),
        host: flags.string({
            char: 'i',
            description: messages.flags.host,
            default: lwcConfig.server.host
        }),
        open: flags.boolean({
            char: 'o',
            description: messages.flags.open,
            default: lwcConfig.server.open
        }),
        port: flags.integer({