List config vars, aliases, display default org details

@W-4285402, W-4285397, W-4285377@
This commit is contained in:
James Sweetman 2017-09-20 10:57:11 -07:00 коммит произвёл GitHub
Родитель e8abbb5fd1
Коммит 0e7636959a
13 изменённых файлов: 269 добавлений и 10 удалений

Просмотреть файл

@ -181,6 +181,10 @@
{ {
"command": "sfdx.force.debugger.stop", "command": "sfdx.force.debugger.stop",
"when": "sfdx:project_opened" "when": "sfdx:project_opened"
},
{
"command": "sfdx.force.config.list",
"when": "sfdx:project_opened"
} }
] ]
}, },
@ -256,6 +260,18 @@
{ {
"command": "sfdx.force.debugger.stop", "command": "sfdx.force.debugger.stop",
"title": "%force_debugger_stop_text%" "title": "%force_debugger_stop_text%"
},
{
"command": "sfdx.force.config.list",
"title": "%force_config_list_text%"
},
{
"command": "sfdx.force.alias.list",
"title": "%force_alias_list_text%"
},
{
"command": "sfdx.force.org.display.default",
"title": "%force_org_display_default_text%"
} }
] ]
} }

Просмотреть файл

@ -22,6 +22,11 @@
"force_lightning_event_create_text": "SFDX: Create Lightning Event", "force_lightning_event_create_text": "SFDX: Create Lightning Event",
"force_lightning_interface_create_text": "SFDX: Create Lightning Interface", "force_lightning_interface_create_text": "SFDX: Create Lightning Interface",
"force_source_status_local_text": "SFDX: View Local Changes", "force_source_status_local_text": "SFDX: View Local Changes",
"force_source_status_remote_text": "SFDX: View Changes in Default Scratch Org", "force_source_status_remote_text":
"force_debugger_stop_text": "SFDX: Stop Apex Debugger Session" "SFDX: View Changes in Default Scratch Org",
"force_debugger_stop_text": "SFDX: Stop Apex Debugger Session",
"force_config_list_text": "SFDX: List All Config Variables",
"force_alias_list_text": "SFDX: List All Aliases",
"force_org_display_default_text":
"SFDX: Display Org Details for Default Scratch Org"
} }

Просмотреть файл

@ -287,6 +287,25 @@ export class SelectStrictDirPath extends SelectDirPath {
} }
} }
export interface FlagParameter<T> {
flag: T;
}
export class SelectUsername
implements ParametersGatherer<{ username: string }> {
public async gather(): Promise<
CancelResponse | ContinueResponse<{ username: string }>
> {
const usernameInputOptions = <vscode.InputBoxOptions>{
prompt: nls.localize('parameter_gatherer_enter_username_name')
};
const username = await vscode.window.showInputBox(usernameInputOptions);
return username
? { type: 'CONTINUE', data: { username } }
: { type: 'CANCEL' };
}
}
// Command Execution // Command Execution
//////////////////// ////////////////////
export interface CommandletExecutor<T> { export interface CommandletExecutor<T> {

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) 2017, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import {
Command,
SfdxCommandBuilder
} from '@salesforce/salesforcedx-utils-vscode/out/src/cli';
import { nls } from '../messages';
import {
EmptyParametersGatherer,
SfdxCommandlet,
SfdxCommandletExecutor,
SfdxWorkspaceChecker
} from './commands';
export class ForceAliasList extends SfdxCommandletExecutor<{}> {
public build(data: {}): Command {
return new SfdxCommandBuilder()
.withDescription(nls.localize('force_alias_list_text'))
.withArg('force:alias:list')
.build();
}
}
const workspaceChecker = new SfdxWorkspaceChecker();
const parameterGatherer = new EmptyParametersGatherer();
const executor = new ForceAliasList();
const commandlet = new SfdxCommandlet(
workspaceChecker,
parameterGatherer,
executor
);
export function forceAliasList() {
commandlet.run();
}

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) 2017, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import {
Command,
SfdxCommandBuilder
} from '@salesforce/salesforcedx-utils-vscode/out/src/cli';
import { nls } from '../messages';
import {
EmptyParametersGatherer,
SfdxCommandlet,
SfdxCommandletExecutor,
SfdxWorkspaceChecker
} from './commands';
export class ForceConfigList extends SfdxCommandletExecutor<{}> {
public build(data: {}): Command {
return new SfdxCommandBuilder()
.withDescription(nls.localize('force_config_list_text'))
.withArg('force:config:list')
.build();
}
}
const workspaceChecker = new SfdxWorkspaceChecker();
const parameterGatherer = new EmptyParametersGatherer();
const executor = new ForceConfigList();
const commandlet = new SfdxCommandlet(
workspaceChecker,
parameterGatherer,
executor
);
export function forceConfigList() {
commandlet.run();
}

Просмотреть файл

@ -0,0 +1,48 @@
/*
* Copyright (c) 2017, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import {
Command,
SfdxCommandBuilder
} from '@salesforce/salesforcedx-utils-vscode/out/src/cli';
import { nls } from '../messages';
import {
EmptyParametersGatherer,
FlagParameter,
SfdxCommandlet,
SfdxCommandletExecutor,
SfdxWorkspaceChecker
} from './commands';
export class ForceOrgDisplay extends SfdxCommandletExecutor<{}> {
private flag: string | undefined;
public constructor(flag?: string) {
super();
this.flag = flag;
}
public build(data: { username?: string }): Command {
return new SfdxCommandBuilder()
.withDescription(nls.localize('force_org_display_default_text'))
.withArg('force:org:display')
.build();
}
}
const workspaceChecker = new SfdxWorkspaceChecker();
const parameterGatherer = new EmptyParametersGatherer();
const executor = new ForceOrgDisplay();
const commandlet = new SfdxCommandlet(
workspaceChecker,
parameterGatherer,
executor
);
export function forceOrgDisplay(this: FlagParameter<string>) {
commandlet.run();
}

Просмотреть файл

@ -12,6 +12,7 @@ import {
import { nls } from '../messages'; import { nls } from '../messages';
import { import {
EmptyParametersGatherer, EmptyParametersGatherer,
FlagParameter,
SfdxCommandlet, SfdxCommandlet,
SfdxCommandletExecutor, SfdxCommandletExecutor,
SfdxWorkspaceChecker SfdxWorkspaceChecker
@ -48,11 +49,7 @@ export class ForceSourceStatusExecutor extends SfdxCommandletExecutor<{}> {
const workspaceChecker = new SfdxWorkspaceChecker(); const workspaceChecker = new SfdxWorkspaceChecker();
const parameterGatherer = new EmptyParametersGatherer(); const parameterGatherer = new EmptyParametersGatherer();
export interface FlagParameter { export function forceSourceStatus(this: FlagParameter<SourceStatusFlags>) {
flag: SourceStatusFlags;
}
export function forceSourceStatus(this: FlagParameter) {
// tslint:disable-next-line:no-invalid-this // tslint:disable-next-line:no-invalid-this
const flag = this ? this.flag : undefined; const flag = this ? this.flag : undefined;
const executor = new ForceSourceStatusExecutor(flag); const executor = new ForceSourceStatusExecutor(flag);

Просмотреть файл

@ -23,3 +23,6 @@ export { forceLightningComponentCreate } from './forceLightningComponentCreate';
export { forceLightningEventCreate } from './forceLightningEventCreate'; export { forceLightningEventCreate } from './forceLightningEventCreate';
export { forceLightningInterfaceCreate } from './forceLightningInterfaceCreate'; export { forceLightningInterfaceCreate } from './forceLightningInterfaceCreate';
export { forceDebuggerStop } from './forceDebuggerStop'; export { forceDebuggerStop } from './forceDebuggerStop';
export { forceConfigList } from './forceConfigList';
export { forceAliasList } from './forceAliasList';
export { forceOrgDisplay } from './forceOrgDisplay';

Просмотреть файл

@ -8,15 +8,18 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { import {
forceAliasList,
forceApexClassCreate, forceApexClassCreate,
forceApexTestRun, forceApexTestRun,
forceAuthWebLogin, forceAuthWebLogin,
forceConfigList,
forceDebuggerStop, forceDebuggerStop,
forceLightningAppCreate, forceLightningAppCreate,
forceLightningComponentCreate, forceLightningComponentCreate,
forceLightningEventCreate, forceLightningEventCreate,
forceLightningInterfaceCreate, forceLightningInterfaceCreate,
forceOrgCreate, forceOrgCreate,
forceOrgDisplay,
forceOrgOpen, forceOrgOpen,
forceSourcePull, forceSourcePull,
forceSourcePush, forceSourcePush,
@ -105,6 +108,18 @@ function registerCommands(): vscode.Disposable {
'sfdx.force.debugger.stop', 'sfdx.force.debugger.stop',
forceDebuggerStop forceDebuggerStop
); );
const forceConfigListCmd = vscode.commands.registerCommand(
'sfdx.force.config.list',
forceConfigList
);
const forceAliasListCmd = vscode.commands.registerCommand(
'sfdx.force.alias.list',
forceAliasList
);
const forceOrgDisplayDefaultCmd = vscode.commands.registerCommand(
'sfdx.force.org.display.default',
forceOrgDisplay
);
// Internal commands // Internal commands
const internalCancelCommandExecution = vscode.commands.registerCommand( const internalCancelCommandExecution = vscode.commands.registerCommand(
@ -131,6 +146,9 @@ function registerCommands(): vscode.Disposable {
forceSourceStatusLocalCmd, forceSourceStatusLocalCmd,
forceSourceStatusRemoteCmd, forceSourceStatusRemoteCmd,
forceDebuggerStopCmd, forceDebuggerStopCmd,
forceConfigListCmd,
forceAliasListCmd,
forceOrgDisplayDefaultCmd,
internalCancelCommandExecution internalCancelCommandExecution
); );
} }

Просмотреть файл

@ -41,9 +41,12 @@ export const messages = {
force_auth_web_login_authorize_dev_hub_text: 'SFDX: Authorize a Dev Hub', force_auth_web_login_authorize_dev_hub_text: 'SFDX: Authorize a Dev Hub',
parameter_gatherer_enter_file_name: 'Enter desired filename', parameter_gatherer_enter_file_name:
'Enter desired filename (Press Enter to confirm or Esc to cancel)',
parameter_gatherer_enter_dir_name: parameter_gatherer_enter_dir_name:
"Enter desired directory (Press 'Enter' to confirm or 'Escape' to cancel)", 'Enter desired directory (Press Enter to confirm or Esc to cancel)',
parameter_gatherer_enter_username_name:
'Enter target username (Press Enter to confirm or Esc to cancel)',
force_org_create_default_scratch_org_text: force_org_create_default_scratch_org_text:
'SFDX: Create a Default Scratch Org...', 'SFDX: Create a Default Scratch Org...',
@ -78,5 +81,9 @@ export const messages = {
warning_prompt_lightning_bundle_overwrite: warning_prompt_lightning_bundle_overwrite:
'A Lightning bundle with the specified path already exists in your workspace. Do you want to overwrite any existing files in this bundle?', 'A Lightning bundle with the specified path already exists in your workspace. Do you want to overwrite any existing files in this bundle?',
warning_prompt_yes: 'Yes', warning_prompt_yes: 'Yes',
warning_prompt_no: 'No' warning_prompt_no: 'No',
force_config_list_text: 'SFDX: List All Config Variables',
force_alias_list_text: 'SFDX: List All Aliases',
force_org_display_default_text:
'SFDX: Display Org Details for Default Scratch Org'
}; };

Просмотреть файл

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { expect } from 'chai';
import { ForceAliasList } from '../../src/commands/forceAliasList';
import { nls } from '../../src/messages';
// tslint:disable:no-unused-expression
describe('Force Alias List', () => {
it('Should build the alias list command', async () => {
const aliasList = new ForceAliasList();
const aliasListCommand = aliasList.build({});
expect(aliasListCommand.toCommand()).to.equal('sfdx force:alias:list');
expect(aliasListCommand.description).to.equal(
nls.localize('force_alias_list_text')
);
});
});

Просмотреть файл

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { expect } from 'chai';
import { ForceConfigList } from '../../src/commands/forceConfigList';
import { nls } from '../../src/messages';
// tslint:disable:no-unused-expression
describe('Force Config List', () => {
it('Should build the config list command', async () => {
const configList = new ForceConfigList();
const configListCommand = configList.build({});
expect(configListCommand.toCommand()).to.equal('sfdx force:config:list');
expect(configListCommand.description).to.equal(
nls.localize('force_config_list_text')
);
});
});

Просмотреть файл

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { expect } from 'chai';
import { ForceOrgDisplay } from '../../src/commands/forceOrgDisplay';
import { nls } from '../../src/messages';
// tslint:disable:no-unused-expression
describe('Force Source Status', () => {
it('Should build the source command no flag', async () => {
const forceOrgDisplay = new ForceOrgDisplay();
const displayCommand = forceOrgDisplay.build({});
expect(displayCommand.toCommand()).to.equal('sfdx force:org:display');
expect(displayCommand.description).to.equal(
nls.localize('force_org_display_default_text')
);
});
});