Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { checkAppDir } from './utils/checkAppDir'
import { createApp } from './utils/createApp'
import { createAppDir } from './utils/createAppDir'
import { getProjectType } from './utils/getProjectType'
import { install } from './utils/install'
import { setAppName } from './utils/setAppName'
import { showTips } from './utils/showTips'
const { green, yellow } = chalk
class CreateDahliaApp extends Command {
static description = 'describe the command here'
static flags = {
// add --version flag to show CLI version
version: flags.version({ char: 'v' }),
help: flags.help({ char: 'h' }),
}
static args = [{ name: 'appName' }]
async run() {
const { args } = this.parse(CreateDahliaApp)
const appName: string = args.appName
if (!appName) {
return this.log(yellow('required project name, eg: '), green('create-dahlia-app myapp'))
}
const root = path.resolve(appName)
console.log(yosay('您正在初始化 dahlia 项目...'))
try {
// Default provided in `run` method
description: "Directories to ignore under src",
multiple: true
}),
port: flags.integer({
description: "Port to run the report server on",
default: 3001
}),
quiet: flags.boolean({
description: "No output to stdout",
default: false
}),
// Meta flags
help: flags.help({ char: "h" }),
version: flags.version({ char: "v" }),
// Hidden flags
json: flags.boolean({
description: "Output report as JSON rather than starting the app",
hidden: true
})
};
static args = [
{ name: "schema", required: true },
{ name: "sourceDir", required: true }
];
async run() {
const { args, flags } = this.parse(GraphqlStats);
const { schema, sourceDir } = args;
import 'reflect-metadata';
import { createRootContainer } from './inversify.config';
import { Scanner } from './scanner/Scanner';
import { Command, flags } from '@oclif/command';
import cli from 'cli-ux';
import { ServiceError } from './lib/errors';
class DXScannerCommand extends Command {
static description = 'Scan your project for possible DX recommendations.';
static flags = {
// add --version flag to show CLI version
version: flags.version({ char: 'v', description: 'Current version' }),
help: flags.help({ char: 'h', description: 'Help' }),
// flag with a value (-n, --name=VALUE)
authorization: flags.string({ char: 'a', description: 'Credentials to the repository.' }),
// flag with no value (-f, --force)
force: flags.boolean({ char: 'f' }),
json: flags.boolean({ char: 'j', description: 'Output in JSON' }),
};
static args = [{ name: 'path' }];
async run() {
const { args, flags } = this.parse(DXScannerCommand);
let authorization = flags.authorization ? flags.authorization : undefined;
const json = flags.json ? flags.json : undefined;
// const name = flags.name || 'world';
import { flags } from "@oclif/command";
import Base from "../base";
var debug = require("debug")("mycli:init");
const { prompt } = require("enquirer");
const copy = require("copy-template-dir");
const path = require("path");
const { spawn } = require("yarn-or-npm");
const chalk = require("chalk");
const ora = require("ora");
class Mycli extends Base {
static description = "describe the command here";
static flags = {
// add --version flag to show CLI version
version: flags.version({ char: "v" }),
help: flags.help({ char: "h" }),
// flag with a value (-n, --name=VALUE)
name: flags.string({
char: "n",
description: "name to print"
}),
// flag with no value (-f, --force)
force: flags.boolean({ char: "f" })
};
static args = [{ name: "file" }];
static strict = false;
async run() {
const { args, flags } = this.parse(Mycli);
// debug("parsing args", args);
// debug("parsing flags", flags);
import { createApp } from "./server";
import { forkModule, requireFork, requireModule } from "./vscode/bootstrapFork";
import { SharedProcess, SharedProcessState } from "./vscode/sharedProcess";
import opn = require("opn");
export class Entry extends Command {
public static description = "Start your own self-hosted browser-accessible VS Code";
public static flags = {
cert: flags.string(),
"cert-key": flags.string(),
"data-dir": flags.string({ char: "d" }),
help: flags.help(),
host: flags.string({ char: "h", default: "0.0.0.0" }),
open: flags.boolean({ char: "o", description: "Open in browser on startup" }),
port: flags.integer({ char: "p", default: 8443, description: "Port to bind on" }),
version: flags.version({ char: "v" }),
"no-auth": flags.boolean({ default: false }),
"allow-http": flags.boolean({ default: false }),
password: flags.string(),
// Dev flags
"bootstrap-fork": flags.string({ hidden: true }),
"fork": flags.string({ hidden: true }),
args: flags.string({ hidden: true }),
};
public static args = [{
name: "workdir",
description: "Specify working dir",
default: (): string => process.cwd(),
}];
# Import data from a Firebase JSON database to Hasura GraphQL Engine without admin secret
firebase2graphql https://hge.herokuapp.com --db=./path/to/db.json
# Import data from a Firebase JSON database to Hasura GraphQL Engine with admin secret
firebase2graphql https://hge.herokuapp.com --db=./path/to/db.json -s
# Import data from a Firebase JSON database to Hasura GraphQL Engine while normalizing it
firebase2graphql https://hge.herokuapp.com --db=./path/to/db.json -n
`;
Firebase2GraphQL.usage = 'URL [-s SECRET]';
Firebase2GraphQL.flags = {
// add --version flag to show CLI version
version: flags.version(),
// add --help flag to show CLI version
help: flags.help({char: 'h'}),
// Admin secret to Hasura GraphQL Engine
'admin-secret': flags.string({
char: 's',
description: 'Admin secret to Hasura GraphQL Engine (X-Hasura-Admin-Secret). Use the flag --access-key if GraphQL Engine version is older than v1.0.0-alpha38',
}),
// Access key to Hasura GraphQL Engine
'access-key': flags.string({
char: 'k',
description: 'Access key to Hasura GraphQL Engine (X-Hasura-Access-Key). Use the flag --admin-secret if GraphQL Engine version is greater than v1.0.0-alpha37',
}),
ShouldICliCommand.description = `
Decision-making made easy. Ask a question to get back a yes or no answer.
`;
ShouldICliCommand.args = [
{
name: 'question',
required: true,
description: 'the question you want answered',
},
];
ShouldICliCommand.flags = {
// add --version flag to show CLI version
version: flags.version({char: 'v'}),
// add --help flag to show CLI version
help: flags.help({char: 'h'}),
};
module.exports = ShouldICliCommand;
import { Command, flags } from '@oclif/command';
class Example2 extends Command {
static description = 'describe the command here';
static flags = {
// add --version flag to show CLI version
version: flags.version({ char: 'v' }),
help: flags.help({ char: 'h' }),
// flag with a value (-n, --name=VALUE)
name: flags.string({ char: 'n', description: 'name to print' }),
// flag with no value (-f, --force)
force: flags.boolean({ char: 'f' }),
};
static args = [{ name: 'file' }];
async run() {
const { args, flags } = this.parse(Example2);
const name = flags.name || 'world';
this.log(`hello ${name} from ./src/index.ts`);
if (args.file && flags.force) {
this.log(`you input --force and --file: ${args.file}`);
ProcsyCommand.usage = 'procsy -t http://google.com'
ProcsyCommand.examples = `
${chalk.dim('# Simple proxying')}
$ procsy -t http://google.com
${chalk.dim('# Subdomain proxying')}
$ procsy -t api,http://my-external-api.com
${chalk.dim('# Subdomain and domain proxying')}
$ procsy -t api,http://my-external-api.com -t *,http://my-app.com
`
ProcsyCommand.flags = {
version: flags.version({ char: 'v' }),
help: flags.help({ char: 'h' }),
target: flags.string({
char: 't',
description: 'Proxy target',
multiple: true,
parse: input => ['*'].concat(input.split(',')).slice(-2),
required: true
}),
port: flags.string({
char: 'p',
env: 'PORT',
default: '3001'
})
}
import {Command, flags} from '@oclif/command'
import * as Config from '@oclif/config';
import {S3} from 'aws-sdk'
const Listr = require('listr')
class S3Audit extends Command {
static description = 'describe the command here'
static flags = {
version: flags.version({char: 'v'}),
help: flags.help({char: 'h'}),
}
private s3: S3;
constructor(argv: string[], config: Config.IConfig) {
super(argv, config);
this.s3 = new S3();
}
async run() {
const buckets: string[] = []
this.s3.listBuckets((error: Object, data?: S3.Types.ListBucketsOutput) => {
if (!data || typeof data.Buckets === 'undefined') {