Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('Account already created! Try starting the operator with `operator start`')
return
}
// There are no accounts so create one!
const newAccount = await createAccount(cmd.plaintext)
if (newAccount === undefined) {
return
}
console.log('Created new account with address:', newAccount.address.green)
const keystorePath = path.join(keystoreDirectory, new Date().toISOString() + '--' + newAccount.address)
console.log('Saving encrypted account to:', keystorePath.yellow)
fs.writeFileSync(keystorePath, newAccount.keystoreFile)
// Create new password file
})
program
.command('list')
.description('list all accounts')
.action((none, cmd) => {
let counter = 0
if (!fs.existsSync(keystoreDirectory)) {
console.log('No accounts found!')
return
}
fs.readdirSync(keystoreDirectory).forEach(file => {
console.log('Account #' + counter++ + ':', file.split('--')[1])
})
})
async function createAccount (isPlaintext) {
if (isPlaintext) {
const newAccount = web3.eth.accounts.create()
.version(pkg.version)
.option('-r, --remote', 'Remotely access Silk')
.option('-d, --dev', 'Show debug messages')
.option('-o, --open', 'Open Silk in a window');
program
.command('run')
.description('Starts silk. Default command.')
.action(run);
program
.command('add-app [path]')
.description('add app')
.action(addApp);
program
.command('remove-app [path]')
.description('remove app')
.action(removeApp);
program
.parse(process.argv);
lastArgv = process.argv[process.argv.length - 1];
if (lastArgv === 'help' || lastArgv === 'help') {
// silk help or npm start help was run.
program.help();
process.exit(0);
}
// Silk was run with no command, so we do the default
// Setting a default command appears to be broken in commander.js
self = this;
pkg = manifest_1.getPackageInfo();
return [4 /*yield*/, manifest_1.checkForUpdates()];
case 1:
updateInfo = _a.sent();
if (updateInfo.isOutdated) {
console.warn(cli_1.makeYellow("You have " + updateInfo.name + " version " + updateInfo.current + " installed. The latest is " + updateInfo.latest + ".\n" +
("Run `npm -g install " + updateInfo.name + "` to upgrade.\n")));
}
// Setup basic CLI info
program
.version(pkg.version);
// Setup initiator action. This watches local FSevents directly, connects to the remote host over SSH to watch
// remote FSevents (by running another instance of itself, remotely, in watch more), and runs the actual
// unison sync process when an FSevent is received.
program
.command('sync ')
.description('Run bidirectional sync process with file watching.')
.option("--freq ", "How many seconds to wait between periodic full tree syncs", 30)
.action(function (configPath, options) {
var freq = parseInt(options.freq, 10);
self.run__sync(configPath, freq);
});
// Setup remote watcher action. This command is ran over an SSH connection by the sync initiator. It doesn't
// actually sync anything - it just watches the given directory and dumps FSevent notifications to stdout. The
// sync initiator reacts to those events by running the sync process.
program
.command('watch ')
.option("-i, --ignore ", "File patterns to ignore, separated by semicolons.")
.description('Run file watcher and dump changed files to stdout.')
.action(function (rootPath, options) {
var ignorePatterns = options.ignore
.option('-s, --silent', 'Do not render any stats in the terminal')
.option('-w, --write <s>', 'Write a file with coverage stats')
.description('Schema coverage based on documents')
.action((documents: string, schema: string, cmd: commander.Command) =>
coverage(documents, schema, normalizeOptions(cmd)),
);
commander
.command('introspect ')
.option('-w, --write <s>', 'Write to a file')
.description('Introspect a schema')
.action((schema: string, cmd: commander.Command) =>
introspect(schema, normalizeOptions(cmd)),
);
commander.command('*').action(() => commander.help());
commander.parse(process.argv);
if (process.argv.length === 2) {
ui({
port: defaultPort,
}).catch(e => {
console.log(e);
process.exit(1);
});
}
</s></s>
.description('setup the requirements on the target server.')
.option("-t, --tasks ", 'tasks')
.action(function (sites, options) {
var config = config_1.readConfig(prog.config);
var a = new actions_1.SetupAction(config);
var deployment = Deployment_1.Deployment.create(config, config.app.root || cwd);
var done = a.run(deployment, sites, options.tasks ? options.tasks.split(/,/) : null);
done.then(function (mapResult) {
console.log(SummaryMapConsoleFormatter_1.SummaryMapConsoleFormatter.format(mapResult));
var errorCode = SummaryMap_1.haveSummaryMapsErrors(mapResult) ? 1 : 0;
});
done.catch(function (res) {
console.error(res);
});
});
prog.command('logs [sites...]')
.description('tail the logs')
.option("-f, --tail", 'tail')
.option("--init ", 'init type, could be "systemd".')
.action(function (sites, options) {
var config = config_1.readConfig(prog.config);
var a = new actions_1.LogsAction(config);
var deployment = Deployment_1.Deployment.create(config, config.app.root || cwd);
a.run(deployment, sites, options);
});
prog.command('start [sites...]')
.description('start the app.')
.action(function (sites, options) {
var config = config_1.readConfig(prog.config);
var actions = new actions_1.StartAction(config);
var deployment = Deployment_1.Deployment.create(config, config.app.root || cwd);
var done = actions.run(deployment, sites);
console.log("Define application directory using option 'dir' (ex: hr.js new -d my_app)");
return;
}
var defaultApp = path.resolve(__dirname, "../lib/defaults/app");
console.log("Create new application in "+this.dir);
wrench.copyDirSyncRecursive(defaultApp, this.dir, {
forceDelete: true
});
});
_cli
.command('build')
.description('build application code.')
.action(appCall('build'));
_cli
.command('run')
.description('run simple http server for application.')
.action(appCall('run'));
_cli
.command('dev')
.description('Watches your sources and rebuilds on changes. Useful for interactive development.')
.action(appCall('dev'));
_cli
.option('-d, --dir
.option('-c, --config [value]', 'Relative path to config file.')
.action(options => {
const action = new List(options);
action.invoke();
});
program
.command('pull [name]')
.description('Generate SQL files for all tables, stored procedures, functions, etc.')
.option('-c, --config [value]', 'Relative path to config file.')
.action((name, options) => {
const action = new Pull(name, options);
action.invoke();
});
program
.command('push [name]')
.description('Execute all scripts against the requested database.')
.option('-c, --config [value]', 'Relative path to config file.')
.option('-s, --skip', 'Skip user warning prompt.')
.action((name, options) => {
const action = new Push(name, options);
action.invoke();
});
program.version((pkg as any).version).parse(process.argv);
#!/usr/bin/env node
var asar = require('../lib/asar')
var program = require('commander')
program.version('v' + require('../package.json').version)
.description('Manipulate asar archive files')
program.command('pack <dir> <output>')
.alias('p')
.description('create asar archive')
.option('--ordering ', 'path to a text file for ordering contents')
.option('--unpack ', 'do not pack files matching glob ')
.option('--unpack-dir ', 'do not pack dirs matching glob or starting with literal ')
.option('--snapshot', 'create snapshot')
.option('--exclude-hidden', 'exclude hidden files')
.option('--sv ', '(snapshot) version of Electron')
.option('--sa ', '(snapshot) arch of Electron')
.option('--sb ', '(snapshot) where to put downloaded files')
.action(function (dir, output, options) {
options = {
unpack: options.unpack,
unpackDir: options.unpackDir,
snapshot: options.snapshot,
ordering: options.ordering,</output></dir>
exec = require('child_process').exec,
registries = require('./registries.json'),
PKG = require('./package.json'),
CGRRC = path.join(process.env.HOME, '.cgrrc'),
npmRe = {
get: 'npm config get registry',
set: 'npm config set registry'
},
yarnRe = {
get: 'yarn config get registry',
set: 'yarn config set registry'
};
program.version(PKG.version);
program
.command('ls')
.description('List all the registries')
.action(onList);
program
.command('current')
.description('Show current registry name')
.action(showCurrent);
program
.command('use [type]')
.description('Change registry to registry')
.action(onUse);
program
.command('add [home]')
program
.command('import [handlebarsOptionsFile]')
.description(
'The file containing the JSON data to import. Defaults to "example-data.json". Then the dummy helpers JS file (optional).'
)
.action(async function(filepath, handlebarsOptionsFile) {
await handleImportCommand({
url: program.url,
token: program.token,
filepath,
handlebarsOptionsFile
})
})
program
.command('importDir ')
.description(
'The path to the directory content to import. Defaults to "./DirectoriesToInject".'
)
.action(async function(directoryPath) {
await handleImportDirCommand({
url: program.url,
token: program.token,
directoryPath
})
})
program
.command('generateFiles [path] [filesCount]')
.description('Generates a given number of small files.')
.action(function(path, filesCount) {