Skip to content

Commit

Permalink
add contract create option
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Crowder <[email protected]>
  • Loading branch information
cheeseandcereal committed Mar 10, 2020
1 parent c702912 commit 683b63d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 5.4.1

- **Bugs:**
- Add additional option `-a` in contract create for case where arguments can't normally be parsed on the command line (such as when desired argument is a flag itself)

## 5.4.0

- **Feature:**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dctl",
"version": "5.4.0",
"version": "5.4.1",
"description": "Get your Dragonchain out of it's shell.",
"author": "Dragonchain, Inc. <[email protected]>",
"license": "Apache-2.0",
Expand Down
7 changes: 5 additions & 2 deletions src/dctl-contract-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ program
ex: '[{"fieldName":"aField","path":".thing","type":"text","options":{"sortable":true}}]'
See here for syntax: https://node-sdk-docs.dragonchain.com/latest/interfaces/customtextfieldoptions.html`
)
.option('-a, --argsJSON <argsJSON>', 'JSON string array of container arguments (if args cannot be parsed normally)')
.option('-v, --verbose', '(optional) Enable STDOUT logger in your Dragonchain SDK')
.option('-i, --dragonchainId [dragonchainID]', '(optional) Override the default dragonchain ID for this command')
.action((transactionType, image, cmd, containerArgs, options) => {
const { customIndexes, serial, environmentVariables, secrets, scheduleIntervalInSeconds, cronExpression, registryCredentials } = options;
const { customIndexes, serial, environmentVariables, secrets, scheduleIntervalInSeconds, cronExpression, registryCredentials, argsJSON } = options;
let usedArgs = containerArgs;
if (argsJSON) usedArgs = JSON.parse(argsJSON);
util.wrapper(program, async client => {
const params = util.removeUndefined({
transactionType,
Expand All @@ -33,7 +36,7 @@ program
secrets: secrets ? JSON.parse(secrets) : undefined,
registryCredentials,
cronExpression,
args: containerArgs,
args: usedArgs,
scheduleIntervalInSeconds: scheduleIntervalInSeconds && Number(scheduleIntervalInSeconds),
environmentVariables: environmentVariables && JSON.parse(environmentVariables),
executionOrder: serial ? 'serial' : 'parallel',
Expand Down

0 comments on commit 683b63d

Please sign in to comment.