How to use the @oclif/command.flags.build 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 / utils / command.ts View on Github external
parse: parser,
  })
}

export const Flags = {
  address: flags.build({
    parse: parseAddress,
    description: 'Account Address',
    helpValue: '0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d',
  }),
  publicKey: flags.build({
    parse: parsePublicKey,
    description: 'Public Key',
    helpValue: '0x',
  }),
  url: flags.build({
    parse: parseUrl,
    description: 'URL',
    helpValue: 'htttps://www.celo.org',
  }),
}

export const Args = {
  address: argBuilder(parseAddress),
  file: argBuilder(parsePath),
  // TODO: Check that the file path is possible
  newFile: argBuilder((x) => x),
}
github celo-org / celo-monorepo / packages / cli / src / utils / command.ts View on Github external
export function argBuilder(parser: ParseFn): ArgBuilder {
  return (name, args) => ({
    name,
    ...args,
    required: true,
    parse: parser,
  })
}

export const Flags = {
  address: flags.build({
    parse: parseAddress,
    description: 'Account Address',
    helpValue: '0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d',
  }),
  publicKey: flags.build({
    parse: parsePublicKey,
    description: 'Public Key',
    helpValue: '0x',
  }),
  url: flags.build({
    parse: parseUrl,
    description: 'URL',
    helpValue: 'htttps://www.celo.org',
  }),
}

export const Args = {
  address: argBuilder(parseAddress),
  file: argBuilder(parsePath),
  // TODO: Check that the file path is possible
  newFile: argBuilder((x) => x),
github ArkEcosystem / core / packages / core-tester-cli / src / flags.ts View on Github external
import { flags } from "@oclif/command";

export const satoshiFlag = flags.build({
    parse: input => {
        const value = Number(input);

        if (value < 1 / 1e8) {
            throw new Error(`Expected number greater than 1 satoshi.`);
        }

        return value;
    },
});
github TracerBench / tracerbench / packages / cli / src / helpers / flags.ts View on Github external
export const headless = flags.boolean({
  description: `Run with headless chrome flags`,
  default: false,
});

export const insights = flags.boolean({
  description: `Analyze insights from command.`,
  default: false,
});

export const debug = flags.boolean({
  description: `Debug flag per command. Will output noisy command`,
  default: false,
});

export const regressionThreshold = flags.build({
  default: () => getDefaultValue('regressionThreshold'),
  description: `The upper limit the experiment can regress slower in milliseconds. eg 100`,
  parse: (ms): number => {
    return parseInt(ms, 10);
  },
});

export const iterations = flags.build({
  default: () => getDefaultValue('iterations'),
  description: `Number of runs`,
  parse: iterations => {
    parseInt(iterations, 10);
  },
});

export const browserArgs = flags.build({
github celo-org / celo-monorepo / packages / cli / src / utils / command.ts View on Github external
}
}

type Omit = Pick>
type ArgBuilder = (name: string, args?: Partial, 'name' | 'parse'>>) => IArg
export function argBuilder(parser: ParseFn): ArgBuilder {
  return (name, args) => ({
    name,
    ...args,
    required: true,
    parse: parser,
  })
}

export const Flags = {
  address: flags.build({
    parse: parseAddress,
    description: 'Account Address',
    helpValue: '0xc1912fEE45d61C87Cc5EA59DaE31190FFFFf232d',
  }),
  publicKey: flags.build({
    parse: parsePublicKey,
    description: 'Public Key',
    helpValue: '0x',
  }),
  url: flags.build({
    parse: parseUrl,
    description: 'URL',
    helpValue: 'htttps://www.celo.org',
  }),
}
github superfly / fly / packages / cli / src / flags.ts View on Github external
import { flags } from "@oclif/command"
import { getSavedAccessToken } from "./credentials"

export const env = flags.build({
  name: "env",
  description: "environment to use for commands",
  default: () => process.env.FLY_ENV || process.env.NODE_ENV || "development"
})

export const app = flags.build({
  name: "app",
  char: "a",
  description: "The app to run commands against",
  env: "FLY_APP_NAME"
})

export const apiToken = flags.build({
  name: "token",
  description: "The api token to use. This will override the token created with `fly login` if present.",
  env: "FLY_ACCESS_TOKEN"