List config vars, aliases, display default org details
@W-4285402, W-4285397, W-4285377@
This commit is contained in:
Родитель
e8abbb5fd1
Коммит
0e7636959a
|
@ -181,6 +181,10 @@
|
|||
{
|
||||
"command": "sfdx.force.debugger.stop",
|
||||
"when": "sfdx:project_opened"
|
||||
},
|
||||
{
|
||||
"command": "sfdx.force.config.list",
|
||||
"when": "sfdx:project_opened"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -256,6 +260,18 @@
|
|||
{
|
||||
"command": "sfdx.force.debugger.stop",
|
||||
"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_interface_create_text": "SFDX: Create Lightning Interface",
|
||||
"force_source_status_local_text": "SFDX: View Local Changes",
|
||||
"force_source_status_remote_text": "SFDX: View Changes in Default Scratch Org",
|
||||
"force_debugger_stop_text": "SFDX: Stop Apex Debugger Session"
|
||||
"force_source_status_remote_text":
|
||||
"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
|
||||
////////////////////
|
||||
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 {
|
||||
EmptyParametersGatherer,
|
||||
FlagParameter,
|
||||
SfdxCommandlet,
|
||||
SfdxCommandletExecutor,
|
||||
SfdxWorkspaceChecker
|
||||
|
@ -48,11 +49,7 @@ export class ForceSourceStatusExecutor extends SfdxCommandletExecutor<{}> {
|
|||
const workspaceChecker = new SfdxWorkspaceChecker();
|
||||
const parameterGatherer = new EmptyParametersGatherer();
|
||||
|
||||
export interface FlagParameter {
|
||||
flag: SourceStatusFlags;
|
||||
}
|
||||
|
||||
export function forceSourceStatus(this: FlagParameter) {
|
||||
export function forceSourceStatus(this: FlagParameter<SourceStatusFlags>) {
|
||||
// tslint:disable-next-line:no-invalid-this
|
||||
const flag = this ? this.flag : undefined;
|
||||
const executor = new ForceSourceStatusExecutor(flag);
|
||||
|
|
|
@ -23,3 +23,6 @@ export { forceLightningComponentCreate } from './forceLightningComponentCreate';
|
|||
export { forceLightningEventCreate } from './forceLightningEventCreate';
|
||||
export { forceLightningInterfaceCreate } from './forceLightningInterfaceCreate';
|
||||
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 {
|
||||
forceAliasList,
|
||||
forceApexClassCreate,
|
||||
forceApexTestRun,
|
||||
forceAuthWebLogin,
|
||||
forceConfigList,
|
||||
forceDebuggerStop,
|
||||
forceLightningAppCreate,
|
||||
forceLightningComponentCreate,
|
||||
forceLightningEventCreate,
|
||||
forceLightningInterfaceCreate,
|
||||
forceOrgCreate,
|
||||
forceOrgDisplay,
|
||||
forceOrgOpen,
|
||||
forceSourcePull,
|
||||
forceSourcePush,
|
||||
|
@ -105,6 +108,18 @@ function registerCommands(): vscode.Disposable {
|
|||
'sfdx.force.debugger.stop',
|
||||
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
|
||||
const internalCancelCommandExecution = vscode.commands.registerCommand(
|
||||
|
@ -131,6 +146,9 @@ function registerCommands(): vscode.Disposable {
|
|||
forceSourceStatusLocalCmd,
|
||||
forceSourceStatusRemoteCmd,
|
||||
forceDebuggerStopCmd,
|
||||
forceConfigListCmd,
|
||||
forceAliasListCmd,
|
||||
forceOrgDisplayDefaultCmd,
|
||||
internalCancelCommandExecution
|
||||
);
|
||||
}
|
||||
|
|
|
@ -41,9 +41,12 @@ export const messages = {
|
|||
|
||||
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:
|
||||
"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:
|
||||
'SFDX: Create a Default Scratch Org...',
|
||||
|
@ -78,5 +81,9 @@ export const messages = {
|
|||
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?',
|
||||
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')
|
||||
);
|
||||
});
|
||||
});
|
Загрузка…
Ссылка в новой задаче