Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable no-console*/
require('epipebomb')(); // Allow piping to 'head'
var Command = require('commander').Command,
storage = require('../src/server/storage/storage'),
Logger = require('../src/server/logger'),
Projects = require('../src/server/storage/projects'),
logger = new Logger('netsblox:cli:persist'),
program = new Command();
program
.arguments(' ')
.parse(process.argv);
if (!program.args.length === 2) {
console.log('usage: netsblox persist ');
process.exit(1);
}
storage.connect()
.then(() => {
logger.trace('About to print projects for ' + program.args[0]);
return Projects.get(program.args[0], program.args[1]);
})
/* eslint-disable no-console*/
require('epipebomb')(); // Allow piping to 'head'
var Command = require('commander').Command,
Logger = require('../src/server/logger'),
Projects = require('../src/server/storage/projects'),
logger = new Logger('netsblox:cli:export'),
fs = require('fs'),
program = new Command(),
runWithStorage = require('./utils').runWithStorage;
program
.arguments(' ')
.parse(process.argv);
if (program.args.length !== 2) {
console.log('usage: netsblox export-project ');
process.exit(1);
}
var [owner, name] = program.args;
async function exportProject(owner, projectName) {
logger.trace(`About to get project: ${owner} ${projectName}`);
const project = await Projects.get(owner, projectName);
initProgram() {
this.program = new commander.Command()
// CLI 的版本信息
this.program
.version(pkg.version)
// init 命令
this.program
.command('init <dir>')
.description('Init a project by choosing template.')
.action((dir) => initScript(this, dir))
// 提供系统参数来给 commander 解析
this.program.parse(process.argv)
}
</dir>
init (args) {
if (!args) {
args = process.argv
}
if (!util.isValidCypressEnvValue(process.env.CYPRESS_ENV)) {
debug('invalid CYPRESS_ENV value', process.env.CYPRESS_ENV)
return errors.exitWithError(errors.errors.invalidCypressEnv)(
`CYPRESS_ENV=${process.env.CYPRESS_ENV}`
)
}
const program = new commander.Command()
// bug in commaner not printing name
// in usage help docs
program._name = 'cypress'
program.usage(' [options]')
program
.command('help')
.description('Shows CLI help and exits')
.action(() => {
program.help()
})
program
.option('-v, --version', text('version'))
public constructor (cwd: string) {
this.program = new Command('testcafe');
this.experimental = new Command('testcafe-experimental');
this.cwd = cwd || process.cwd();
this.remoteCount = 0;
this.opts = {};
this.args = [];
this._describeProgram();
}
export function cli() {
const program = new Command()
program.version(pkg.version);
program
.description('Runs the type checker over the files and their dependencies. [the glob defaults to ./**/*.svelte]')
.arguments('[rootFilesGlob]')
.option('-d --config-dir <dir>', 'tsconfig/jsconfig directory', process.cwd())
.option('-e --emit-tsx', 'emit compiled .tsx file for debugging', false)
.action((rootFilesGlob, opts) => {
let glob = rootFilesGlob || './**/*.svelte'
console.log(chalk`\n{underline svelte-type-checker ${pkg.version}}\n`)
if (opts.dir && !ts.sys.directoryExists(opts.dir)) {
console.error(`Couldn't find the provided tsconfig directory: ${opts.dir}`);
process.exit(1);
}
</dir>
*
*************************************************************/
import { resolve } from 'path';
import { readFileSync } from 'fs';
import { format as formatUrl } from 'url';
import readline from 'readline';
import { Command } from 'commander';
import elasticsearch from 'elasticsearch';
import { EsArchiver } from './es_archiver';
import { ToolingLog } from '@kbn/dev-utils';
import { readConfigFile } from '@kbn/test';
const cmd = new Command('node scripts/es_archiver');
const resolveConfigPath = v => resolve(process.cwd(), v);
const defaultConfigPath = resolveConfigPath('test/functional/config.js');
cmd
.description(`CLI to manage archiving/restoring data in elasticsearch`)
.option('--es-url [url]', 'url for elasticsearch')
.option('--kibana-url [url]', 'url for kibana (only necessary if using "load" or "unload" methods)')
.option(`--dir [path]`, 'where archives are stored')
.option('--verbose', 'turn on verbose logging')
.option('--config [path]', 'path to a functional test config file to use for default values', resolveConfigPath, defaultConfigPath)
.on('--help', () => {
console.log(readFileSync(resolve(__dirname, './cli_help.txt'), 'utf8'));
});
cmd
main = function (argv) {
var mainDeferred = Q.defer(),
Command = require('commander').Command,
program = new Command(),
outputPath,
params,
finishUp = function (error) {
var ended = function () {
if (error) {
mainDeferred.reject(error);
return;
}
mainDeferred.resolve();
};
if (gmeAuth) {
gmeAuth.unload();
}
if (cliStorage) {
cliStorage.closeDatabase()
async function main() {
const args = new Command()
.description(`Generate web-based treemaps.
Reads a series of
size path
lines from stdin, splits path on '/' and outputs HTML for a treemap.
`)
.option('-o, --output [path]', 'output to file, not stdout')
.option('--title [string]', 'title of output HTML')
.parse(process.argv);
const node = treeFromLines(await readLines());
const treemapJS = await readFile(__dirname + '/../webtreemap.js');
const title = args.title || 'webtreemap';
let output = `
<title>${title}</title>
<style></style>