Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const cmd1 = words[0].toLowerCase();
const args: string[] = words.splice(1, words.length - 1);
let ctx = {
client: clientHttp,
sysinfo: SYSINFO
}
let result: any;
switch (cmd1) {
case 'info':
console.log(colors.gray(' host : ') + SYSINFO.host);
console.log(colors.gray(' port : ') + SYSINFO.port);
console.log(colors.gray(' address : ') + SYSINFO.address);
console.log(colors.gray(' secret : ') + SYSINFO.secret);
break;
case 'testcmd':
result = await testcmd(args);
console.log(result);
break;
case 'test':
console.log('Do some test');
// result = await getBlock(ctx, args);
// handleResult(prnGetBlock, result);
// ctx.client.on();
break;
case 'getblock':
result = await getBlock(ctx, args);
handleResult(prnGetBlock, ctx, result);
break
export function simpleDemo(): void {
console.log(colors.yellow('*** TSDoc API demo: Simple Scenario ***') + os.EOL);
const inputFilename: string = path.resolve(path.join(__dirname, '..', 'assets', 'simple-input.ts'));
console.log('Reading assets/simple-input.ts...');
const inputBuffer: string = fs.readFileSync(inputFilename).toString();
// NOTE: Optionally, can provide a TSDocParserConfiguration here
const tsdocParser: TSDocParser = new TSDocParser();
const parserContext: ParserContext = tsdocParser.parseString(inputBuffer);
console.log(os.EOL + colors.green('Input Buffer:') + os.EOL);
console.log(colors.gray('<<<<<<'));
console.log(inputBuffer);
console.log(colors.gray('>>>>>>'));
console.log(os.EOL + colors.green('Extracted Lines:') + os.EOL);
console.log(JSON.stringify(parserContext.lines.map(x => x.toString()), undefined, ' '));
console.log(os.EOL + colors.green('Parser Log Messages:') + os.EOL);
if (parserContext.log.messages.length === 0) {
console.log('No errors or warnings.');
} else {
for (const message of parserContext.log.messages) {
console.log(inputFilename + message.toString());
}
}
export const init = (options: ICliInitParameters): Promise => {
if (typeof options.path === 'undefined') {
console.log(
colors.red(`'${colors.bold('-p, --path')}' parameter should be provided`),
colors.gray(`(relative path to file which will store your credentials)`)
);
process.exit();
}
const extension = path.extname(options.path);
if (extension !== '.json') {
console.log(colors.red(`'${colors.bold('--path')}' file extension should to be .json`));
process.exit();
}
const authConfig = new AuthConfig({
configPath: options.path,
encryptPassword: options.encrypt,
saveConfigOnDisk: true,
forcePrompts: true,
logMinor(msg) { console.log(colors.gray(msg)); }
logSuccess(msg) { console.log(colors.green(msg)); }
console.log()
console.log(colors.green("Done!!"))
console.log()
console.log(pkg.repository)
if (pkg.repository.url.trim()) {
console.log(colors.cyan("Now run:"))
console.log(colors.cyan(" npm install -g semantic-release-cli"))
console.log(colors.cyan(" semantic-release-cli setup"))
console.log()
console.log(
colors.cyan('Important! Answer NO to "Generate travis.yml" question')
)
console.log()
console.log(
colors.gray(
'Note: Make sure "repository.url" in your package.json is correct before'
)
)
} else {
console.log(
colors.red(
'First you need to set the "repository.url" property in package.json'
)
)
console.log(colors.cyan("Then run:"))
console.log(colors.cyan(" npm install -g semantic-release-cli"))
console.log(colors.cyan(" semantic-release-cli setup"))
console.log()
console.log(
colors.cyan('Important! Answer NO to "Generate travis.yml" question')
)
'install',
]);
console.log();
console.log(colors.green('Done!!'));
console.log();
if (pkg.repository.url.trim()) {
console.log(colors.cyan('Now run:'));
console.log(colors.cyan(' npm install -g semantic-release-cli'));
console.log(colors.cyan(' semantic-release-cli setup'));
console.log();
console.log(colors.cyan('Important! Answer NO to "Generate travis.yml" question'));
console.log();
console.log(
colors.gray('Note: Make sure "repository.url" in your package.json is correct before')
);
} else {
console.log(colors.red('First you need to set the "repository.url" property in package.json'));
console.log(colors.cyan('Then run:'));
console.log(colors.cyan(' npm install -g semantic-release-cli'));
console.log(colors.cyan(' semantic-release-cli setup'));
console.log();
console.log(colors.cyan('Important! Answer NO to "Generate travis.yml" question'));
}
console.log();
async function _runKhaMake(config:KhaMakeConfig, cb) {
if(!Object.keys(config.engineConfig.flags).length){
console.log(colors.cyan(`Compiling ${config.engineConfig.name} to ${config.target}...`));
}else{
let txt = `Compiling ${config.engineConfig.name} to ${config.target} using:`;
for(let flag in config.engineConfig.flags){
txt += colors.gray(`\n- ${C.FLAG_PREFIX + flag}: ${config.engineConfig.flags[flag]}`);
}
console.log(colors.cyan(txt));
}
console.log(colors.yellow(" - - - - "));
let options:any = {
from: C.CURRENT_PATH,
to: config.to,
projectfile: config.projectfile,
target: config.target,
vr: 'none',
pch: false,
intermediate: '',
graphics: config.graphics,
visualstudio: 'vs2017',
+ colors.cyan(initialSpec)
+ colors.green(`" for "${packageName}" because it matches what other projects are using in this repo.`));
return initialSpec;
}
if (this._rushConfiguration.ensureConsistentVersions && !initialSpec && implicitlyPinnedVersion) {
console.log(`Assigning the version range "${colors.cyan(implicitlyPinnedVersion)}" for "${packageName}" because`
+ ` it is already used by other projects in this repo.`);
return implicitlyPinnedVersion;
}
await installManager.ensureLocalPackageManager();
let selectedVersion: string | undefined;
if (initialSpec && initialSpec !== 'latest') {
console.log(colors.gray('Finding versions that satisfy the selector: ') + initialSpec);
console.log();
console.log(`Querying registry for all versions of "${packageName}"...`);
let commandArgs: string[];
if (this._rushConfiguration.packageManager === 'yarn') {
commandArgs = ['info', packageName, 'versions', '--json'];
} else {
commandArgs = ['view', packageName, 'versions', '--json'];
}
const allVersions: string =
Utilities.executeCommandAndCaptureOutput(
this._rushConfiguration.packageManagerToolFilename,
commandArgs,
this._rushConfiguration.commonTempFolder
);
return false;
});
}
if (!exitQueue) {
let cntInQueue = 0;
foldersQueue.forEach((folder) => {
if (folder.processed) {
cntInQueue += 1;
}
});
if (!ctx.options.muteConsole) {
readline.clearLine(process.stdout, 0);
readline.cursorTo(process.stdout, 0, undefined);
process.stdout.write(colors.green.bold('Folders proceeding: ') + cntInQueue + ' out of ' + foldersQueue.length + colors.gray(' [recursive scanning...]'));
}
const results = await ctx.api.getFolderContent(spRootFolder);
(results.folders || []).forEach((folder) => {
const folderElement = {
folder: folder,
serverRelativeUrl: folder.ServerRelativeUrl,
processed: false
};
foldersQueue.push(folderElement);
});
filesList = filesList.concat(results.files || []);
return this.getStructureRecursive(ctx, false, foldersQueue, filesList);
} else {
if (!ctx.options.muteConsole) {