improved code --help localization

fixes #11218
This commit is contained in:
Joao Moreno
2016-08-31 15:41:23 +02:00
parent 564889c8cb
commit 06241839f3
2 changed files with 7 additions and 8 deletions

View File

@@ -122,8 +122,6 @@ export function parseArgs(args: string[]): ParsedArgs {
return minimist(args, options) as ParsedArgs;
}
const executable = 'code' + (os.platform() === 'win32' ? '.exe' : '');
export const optionsHelp: { [name: string]: string; } = {
'-d, --diff': localize('diff', "Open a diff editor. Requires to pass two file paths as arguments."),
'--disable-extensions': localize('disableExtensions', "Disable all installed extensions."),
@@ -177,13 +175,14 @@ function wrapText(text: string, columns: number) : string[] {
return lines;
}
export function buildHelpMessage(version: string): string {
let columns = (<any>process.stdout).isTTY ? (<any>process.stdout).columns : 80;
return `Visual Studio Code v${ version }
export function buildHelpMessage(fullName: string, name: string, version: string): string {
const columns = (<any>process.stdout).isTTY ? (<any>process.stdout).columns : 80;
const executable = `${ name }${ os.platform() === 'win32' ? '.exe' : '' }`;
return `${ fullName } ${ version }
Usage: ${ executable } [arguments] [paths...]
${ localize('usage', "Usage") }: ${ executable } [${ localize('options', "options") }] [${ localize('paths', 'paths') }...]
Options:
${ localize('optionsUpperCase', "Options") }:
${formatOptions(optionsHelp, columns)}`;
}

View File

@@ -29,7 +29,7 @@ export function main(argv: string[]): TPromise<void> {
}
if (args.help) {
console.log(buildHelpMessage(pkg.version));
console.log(buildHelpMessage(product.nameLong, product.applicationName, pkg.version));
} else if (args.version) {
console.log(`${ pkg.version } (${ product.commit })`);
} else if (shouldSpawnCliProcess(args)) {