Skip to content

Commit

Permalink
Merge pull request #44 from texei/contractstatus-value
Browse files Browse the repository at this point in the history
Added texei:contractstatus:value:add command
  • Loading branch information
FabienTaillon authored Sep 30, 2020
2 parents b292249 + cc86443 commit cc8f7ea
Show file tree
Hide file tree
Showing 5 changed files with 234 additions and 16 deletions.
65 changes: 50 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Install npm modules: npm install
Link the plugin: sfdx plugins:link .

<!-- commands -->
* [`sfdx texei:contractstatus:value:add -l <string> -a <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeicontractstatusvalueadd--l-string--a-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
* [`sfdx texei:data:export -d <string> [-o <string>] [-p <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeidataexport--d-string--o-string--p-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
* [`sfdx texei:data:import -d <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeidataimport--d-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
* [`sfdx texei:data:plan:generate -d <string> -o <string> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeidataplangenerate--d-string--o-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
Expand All @@ -36,6 +37,40 @@ Link the plugin: sfdx plugins:link .
* [`sfdx texei:source:layouts:cleanorg [-p <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeisourcelayoutscleanorg--p-string--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)
* [`sfdx texei:user:update [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`](#sfdx-texeiuserupdate--v-string--u-string---apiversion-string---json---loglevel-tracedebuginfowarnerrorfataltracedebuginfowarnerrorfatal)

## `sfdx texei:contractstatus:value:add -l <string> -a <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

add a value to Contract Status picklist

```
USAGE
$ sfdx texei:contractstatus:value:add -l <string> -a <string> [-u <string>] [--apiversion <string>] [--json]
[--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-a, --apiname=apiname (required) API Name of the Contract
Status value to add
-l, --label=label (required) label of the Contract
Status value to add
-u, --targetusername=targetusername username or alias for the target
org; overrides default target org
--apiversion=apiversion override the api version used for
api requests made by this command
--json format output as json
--loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL) [default: warn] logging level for
this command invocation
EXAMPLE
sfdx texei:contractstatus:value:add --label 'My New Contract Status Label' --apiname 'My New Contract Status API Name'
--targetusername texei
```

_See code: [src/commands/texei/contractstatus/value/add.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/contractstatus/value/add.ts)_

## `sfdx texei:data:export -d <string> [-o <string>] [-p <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

export objects' data from org
Expand Down Expand Up @@ -70,7 +105,7 @@ EXAMPLES
sfdx texei:data:export --dataplan ./data/data-plan.json --outputdir ./data --targetusername texei
```

_See code: [src/commands/texei/data/export.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/data/export.ts)_
_See code: [src/commands/texei/data/export.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/data/export.ts)_

## `sfdx texei:data:import -d <string> [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -101,7 +136,7 @@ EXAMPLE
Data imported!
```

_See code: [src/commands/texei/data/import.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/data/import.ts)_
_See code: [src/commands/texei/data/import.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/data/import.ts)_

## `sfdx texei:data:plan:generate -d <string> -o <string> [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand All @@ -128,7 +163,7 @@ EXAMPLE
$ sfdx texei:data:plan:generate --objects Account,Contact,MyCustomObject__c --outputdir ./data
```

_See code: [src/commands/texei/data/plan/generate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/data/plan/generate.ts)_
_See code: [src/commands/texei/data/plan/generate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/data/plan/generate.ts)_

## `sfdx texei:org:contractfieldhistory:fix [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -156,7 +191,7 @@ EXAMPLE
History tracking fixed.
```

_See code: [src/commands/texei/org/contractfieldhistory/fix.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/org/contractfieldhistory/fix.ts)_
_See code: [src/commands/texei/org/contractfieldhistory/fix.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/org/contractfieldhistory/fix.ts)_

## `sfdx texei:org:shape:extract [-d <string>] [-s <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -191,7 +226,7 @@ EXAMPLE
$ sfdx texei:org:shape:extract -u [email protected]"
```

_See code: [src/commands/texei/org/shape/extract.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/org/shape/extract.ts)_
_See code: [src/commands/texei/org/shape/extract.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/org/shape/extract.ts)_

## `sfdx texei:package:dependencies:install [-k <string>] [-b <string>] [-p <string>] [-s <string>] [-n <string>] [-w <number>] [-r] [-a <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -254,7 +289,7 @@ EXAMPLE
$ texei:package:dependencies:install -u MyScratchOrg -v MyDevHub -k "1:MyPackage1Key 2: 3:MyPackage3Key" -b "DEV"
```

_See code: [src/commands/texei/package/dependencies/install.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/package/dependencies/install.ts)_
_See code: [src/commands/texei/package/dependencies/install.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/package/dependencies/install.ts)_

## `sfdx texei:profile:clean [-k <string>] [-p <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -288,7 +323,7 @@ EXAMPLES
custom-sfdx-source-folder/main/profiles,source-folder-2/main/profiles/myAdmin.profile-meta.xml
```

_See code: [src/commands/texei/profile/clean.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/profile/clean.ts)_
_See code: [src/commands/texei/profile/clean.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/profile/clean.ts)_

## `sfdx texei:sharedactivities:enable [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand All @@ -315,7 +350,7 @@ EXAMPLE
$ sfdx texei:sharedactivities:enable
```

_See code: [src/commands/texei/sharedactivities/enable.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/sharedactivities/enable.ts)_
_See code: [src/commands/texei/sharedactivities/enable.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/sharedactivities/enable.ts)_

## `sfdx texei:sharingcalc:recalculate [-s <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -346,7 +381,7 @@ EXAMPLE
Recalculated Sharing Rules
```

_See code: [src/commands/texei/sharingcalc/recalculate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/sharingcalc/recalculate.ts)_
_See code: [src/commands/texei/sharingcalc/recalculate.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/sharingcalc/recalculate.ts)_

## `sfdx texei:sharingcalc:resume [-s <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -377,7 +412,7 @@ EXAMPLE
Sharing calculations resumed
```

_See code: [src/commands/texei/sharingcalc/resume.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/sharingcalc/resume.ts)_
_See code: [src/commands/texei/sharingcalc/resume.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/sharingcalc/resume.ts)_

## `sfdx texei:sharingcalc:suspend [-s <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -408,7 +443,7 @@ EXAMPLE
Sharing calculations suspended
```

_See code: [src/commands/texei/sharingcalc/suspend.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/sharingcalc/suspend.ts)_
_See code: [src/commands/texei/sharingcalc/suspend.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/sharingcalc/suspend.ts)_

## `sfdx texei:skinnyprofile:retrieve [-t <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -441,7 +476,7 @@ EXAMPLE
$ texei:skinnyprofile:retrieve -u MyScratchOrg
```

_See code: [src/commands/texei/skinnyprofile/retrieve.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/skinnyprofile/retrieve.ts)_
_See code: [src/commands/texei/skinnyprofile/retrieve.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/skinnyprofile/retrieve.ts)_

## `sfdx texei:source:customlabel:replace -l <string> -v <string> [-p <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand All @@ -465,7 +500,7 @@ EXAMPLE
$ texei:source:customlabel:replace --label GreatSalesforceBlog --value https://blog.texei.com
```

_See code: [src/commands/texei/source/customlabel/replace.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/source/customlabel/replace.ts)_
_See code: [src/commands/texei/source/customlabel/replace.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/source/customlabel/replace.ts)_

## `sfdx texei:source:layouts:cleanorg [-p <string>] [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -498,7 +533,7 @@ EXAMPLES
$ texei:source:layouts:cleanorg --targetusername myScratchOrg --targetdevhubusername myDevHub
```

_See code: [src/commands/texei/source/layouts/cleanorg.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/source/layouts/cleanorg.ts)_
_See code: [src/commands/texei/source/layouts/cleanorg.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/source/layouts/cleanorg.ts)_

## `sfdx texei:user:update [-v <string>] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`

Expand Down Expand Up @@ -531,5 +566,5 @@ EXAMPLES
sfdx texei:user:update --values "LanguageLocaleKey=en_US UserPermissionsMarketingUser=true" --json
```

_See code: [src/commands/texei/user/update.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.7.0/src/commands/texei/user/update.ts)_
_See code: [src/commands/texei/user/update.ts](https://github.com/texei/texei-sfdx-plugin/blob/v1.8.0/src/commands/texei/user/update.ts)_
<!-- commandsstop -->
5 changes: 5 additions & 0 deletions messages/contractstatus-value-add.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"commandDescription": "add a value to Contract Status picklist",
"labelFlagDescription": "label of the Contract Status value to add",
"apiNameFlagDescription": "API Name of the Contract Status value to add"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "texei-sfdx-plugin",
"description": "Texeï's plugin for sfdx",
"version": "1.7.0",
"version": "1.8.0",
"author": "Texeï",
"bugs": "https://github.com/https://github.com/texei/texei-sfdx-plugin/issues",
"dependencies": {
Expand Down
47 changes: 47 additions & 0 deletions src/commands/texei/contractstatus/value/add.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { core, flags, SfdxCommand } from "@salesforce/command";
import { StandardValueSetHelper } from "../../../../shared/standardValueSetHelper";

// Initialize Messages with the current plugin directory
core.Messages.importMessagesDirectory(__dirname);

// Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core,
// or any library that is using the messages framework can also be loaded this way.
const messages = core.Messages.loadMessages(
"texei-sfdx-plugin",
"contractstatus-value-add"
);

export default class Add extends SfdxCommand {
public static description = messages.getMessage("commandDescription");

public static examples = [
`sfdx texei:contractstatus:value:add --label 'My New Contract Status Label' --apiname 'My New Contract Status API Name' --targetusername texei`,
];

protected static flagsConfig = {
label: flags.string({char: 'l', description: messages.getMessage('labelFlagDescription'), required: true}),
apiname: flags.string({char: 'a', description: messages.getMessage('apiNameFlagDescription'), required: true})
};

// Comment this out if your command does not require an org username
protected static requiresUsername = true;

// Comment this out if your command does not support a hub org username
protected static requiresDevhubUsername = false;

// Set this to true if your command requires a project workspace; 'requiresProject' is false by default
protected static requiresProject = false;

public async run(): Promise<any> {

this.ux.startSpinner(`Adding ContractStatus value (${this.flags.label}/${this.flags.apiname})`, null, { stdout: true });

const svsh = new StandardValueSetHelper(this.org.getConnection(), 'ContractStatus');
await svsh.addValue(this.flags.label, this.flags.apiname);
await svsh.close();

this.ux.stopSpinner('Done.');

return { message: `ContractStatus value added` };
}
}
Loading

0 comments on commit cc8f7ea

Please sign in to comment.