mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-05 17:23:51 -05:00
Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)
* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 * disable strict null check
This commit is contained in:
@@ -8,28 +8,28 @@ import * as os from 'os';
|
||||
import { localize } from 'vs/nls';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { writeFileSync } from 'fs';
|
||||
import { writeFileSync } from 'vs/base/node/pfs';
|
||||
|
||||
/**
|
||||
* This code is also used by standalone cli's. Avoid adding any other dependencies.
|
||||
*/
|
||||
|
||||
class HelpCategories {
|
||||
o = localize('optionsUpperCase', "Options");
|
||||
e = localize('extensionsManagement', "Extensions Management");
|
||||
t = localize('troubleshooting', "Troubleshooting");
|
||||
}
|
||||
const helpCategories = {
|
||||
o: localize('optionsUpperCase', "Options"),
|
||||
e: localize('extensionsManagement', "Extensions Management"),
|
||||
t: localize('troubleshooting', "Troubleshooting")
|
||||
};
|
||||
|
||||
export interface Option {
|
||||
id: string;
|
||||
id: keyof ParsedArgs;
|
||||
type: 'boolean' | 'string';
|
||||
alias?: string;
|
||||
deprecates?: string; // old deprecated id
|
||||
args?: string | string[];
|
||||
description?: string;
|
||||
cat?: keyof HelpCategories;
|
||||
cat?: keyof typeof helpCategories;
|
||||
}
|
||||
|
||||
//_urls
|
||||
export const options: Option[] = [
|
||||
{ id: 'diff', type: 'boolean', cat: 'o', alias: 'd', args: ['file', 'file'], description: localize('diff', "Compare two files with each other.") },
|
||||
{ id: 'add', type: 'boolean', cat: 'o', alias: 'a', args: 'folder', description: localize('add', "Add folder(s) to the last active window.") },
|
||||
@@ -41,6 +41,7 @@ export const options: Option[] = [
|
||||
{ id: 'user-data-dir', type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") },
|
||||
{ id: 'version', type: 'boolean', cat: 'o', alias: 'v', description: localize('version', "Print version.") },
|
||||
{ id: 'help', type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") },
|
||||
{ id: 'telemetry', type: 'boolean', cat: 'o', description: localize('telemetry', "Shows all telemetry events which VS code collects.") },
|
||||
{ id: 'folder-uri', type: 'string', cat: 'o', args: 'uri', description: localize('folderUri', "Opens a window with given folder uri(s)") },
|
||||
{ id: 'file-uri', type: 'string', cat: 'o', args: 'uri', description: localize('fileUri', "Opens a window with given file uri(s)") },
|
||||
|
||||
@@ -54,7 +55,6 @@ export const options: Option[] = [
|
||||
{ id: 'verbose', type: 'boolean', cat: 't', description: localize('verbose', "Print verbose output (implies --wait).") },
|
||||
{ id: 'log', type: 'string', cat: 't', args: 'level', description: localize('log', "Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'.") },
|
||||
{ id: 'status', type: 'boolean', alias: 's', cat: 't', description: localize('status', "Print process usage and diagnostics information.") },
|
||||
{ id: 'prof-modules', type: 'boolean', alias: 'p', cat: 't', description: localize('prof-modules', "Capture performance markers while loading JS modules and print them with 'F1 > Developer: Startup Performance") },
|
||||
{ id: 'prof-startup', type: 'boolean', cat: 't', description: localize('prof-startup', "Run CPU profiler during startup") },
|
||||
{ id: 'disable-extensions', type: 'boolean', deprecates: 'disableExtensions', cat: 't', description: localize('disableExtensions', "Disable all installed extensions.") },
|
||||
{ id: 'disable-extension', type: 'string', cat: 't', args: 'extension-id', description: localize('disableExtension', "Disable an extension.") },
|
||||
@@ -62,7 +62,6 @@ export const options: Option[] = [
|
||||
{ id: 'inspect-extensions', type: 'string', deprecates: 'debugPluginHost', args: 'port', cat: 't', description: localize('inspect-extensions', "Allow debugging and profiling of extensions. Check the developer tools for the connection URI.") },
|
||||
{ id: 'inspect-brk-extensions', type: 'string', deprecates: 'debugBrkPluginHost', args: 'port', cat: 't', description: localize('inspect-brk-extensions', "Allow debugging and profiling of extensions with the extension host being paused after start. Check the developer tools for the connection URI.") },
|
||||
{ id: 'disable-gpu', type: 'boolean', cat: 't', description: localize('disableGPU', "Disable GPU hardware acceleration.") },
|
||||
{ id: 'upload-logs', type: 'string', cat: 't', description: localize('uploadLogs', "Uploads logs from current session to a secure endpoint.") },
|
||||
{ id: 'max-memory', type: 'string', cat: 't', description: localize('maxMemory', "Max memory size for a window (in Mbytes).") },
|
||||
|
||||
{ id: 'remote', type: 'string' },
|
||||
@@ -86,15 +85,14 @@ export const options: Option[] = [
|
||||
{ id: 'skip-add-to-recently-opened', type: 'boolean' },
|
||||
{ id: 'unity-launch', type: 'boolean' },
|
||||
{ id: 'open-url', type: 'boolean' },
|
||||
{ id: 'nolazy', type: 'boolean' },
|
||||
{ id: 'issue', type: 'boolean' },
|
||||
{ id: 'file-write', type: 'boolean' },
|
||||
{ id: 'file-chmod', type: 'boolean' },
|
||||
{ id: 'driver-verbose', type: 'boolean' },
|
||||
{ id: 'force', type: 'boolean' },
|
||||
{ id: 'trace-category-filter', type: 'string' },
|
||||
{ id: 'trace-options', type: 'string' },
|
||||
{ id: 'prof-code-loading', type: 'boolean' },
|
||||
{ id: '_', type: 'string' },
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
{ id: 'command', type: 'string', alias: 'c', cat: 'o', args: 'command-name', description: localize('commandParameter', 'Name of command to run') },
|
||||
{ id: 'database', type: 'string', alias: 'D', cat: 'o', args: 'database', description: localize('databaseParameter', 'Database name') },
|
||||
@@ -103,7 +101,9 @@ export const options: Option[] = [
|
||||
{ id: 'aad', type: 'boolean', cat: 'o', description: localize('aadParameter', 'Use Azure Active Directory authentication for server connection') },
|
||||
{ id: 'integrated', type: 'boolean', alias: 'E', cat: 'o', description: localize('integratedAuthParameter', 'Use Integrated authentication for server connection') },
|
||||
// {{SQL CARBON EDIT}} - End
|
||||
{ id: '_', type: 'string' }
|
||||
|
||||
{ id: 'js-flags', type: 'string' }, // chrome js flags
|
||||
{ id: 'nolazy', type: 'boolean' }, // node inspect
|
||||
];
|
||||
|
||||
export function parseArgs(args: string[], isOptionSupported = (_: Option) => true): ParsedArgs {
|
||||
@@ -130,8 +130,8 @@ export function parseArgs(args: string[], isOptionSupported = (_: Option) => tru
|
||||
}
|
||||
}
|
||||
// remote aliases to avoid confusion
|
||||
const parsedArgs = minimist(args, { string, boolean, alias }) as ParsedArgs;
|
||||
for (let o of options) {
|
||||
const parsedArgs = minimist(args, { string, boolean, alias });
|
||||
for (const o of options) {
|
||||
if (o.alias) {
|
||||
delete parsedArgs[o.alias];
|
||||
}
|
||||
@@ -198,8 +198,6 @@ function wrapText(text: string, columns: number): string[] {
|
||||
export function buildHelpMessage(productName: string, executableName: string, version: string, isOptionSupported = (_: Option) => true, isPipeSupported = true): string {
|
||||
const columns = (process.stdout).isTTY && (process.stdout).columns || 80;
|
||||
|
||||
let categories = new HelpCategories();
|
||||
|
||||
let help = [`${productName} ${version}`];
|
||||
help.push('');
|
||||
help.push(`${localize('usage', "Usage")}: ${executableName} [${localize('options', "options")}][${localize('paths', 'paths')}...]`);
|
||||
@@ -212,10 +210,12 @@ export function buildHelpMessage(productName: string, executableName: string, ve
|
||||
}
|
||||
help.push('');
|
||||
}
|
||||
for (let key in categories) {
|
||||
for (let helpCategoryKey in helpCategories) {
|
||||
const key = <keyof typeof helpCategories>helpCategoryKey;
|
||||
|
||||
let categoryOptions = options.filter(o => !!o.description && o.cat === key && isOptionSupported(o));
|
||||
if (categoryOptions.length) {
|
||||
help.push(categories[key]);
|
||||
help.push(helpCategories[key]);
|
||||
help.push(...formatOptions(categoryOptions, columns));
|
||||
help.push('');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user