Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'.
Browse files Browse the repository at this point in the history
  • Loading branch information
petrbroz committed Jun 25, 2019
2 parents e09dc36 + c6046d7 commit 527b400
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 14 deletions.
22 changes: 18 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "forge-cli-utils",
"version": "1.0.0",
"version": "1.1.0",
"description": "Command line tools for Autodesk Forge services.",
"author": "Petr Broz <[email protected]>",
"license": "MIT",
Expand All @@ -26,7 +26,7 @@
},
"dependencies": {
"commander": "^2.20.0",
"forge-nodejs-utils": "^1.5.1",
"forge-nodejs-utils": "^2.1.0",
"form-data": "^2.3.3",
"inquirer": "^6.3.1"
},
Expand Down
2 changes: 0 additions & 2 deletions src/common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const { ForgeError } = require('forge-nodejs-utils/src/common');

function log(result) {
switch (typeof result) {
case 'object':
Expand Down
116 changes: 115 additions & 1 deletion src/forge-da.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,57 @@ program
}
});

program
.command('delete-appbundle [bundle-short-id]')
.alias('db')
.description('Delete app bundle with all its aliases and versions.')
.action(async function(bundleShortId, command) {
try {
if (!bundleShortId) {
bundleShortId = await promptAppBundle();
}
await designAutomation.deleteAppBundle(bundleShortId);
} catch(err) {
error(err);
}
});

program
.command('delete-appbundle-alias [bundle-short-id] [alias]')
.alias('dba')
.description('Delete app bundle alias.')
.action(async function(bundleShortId, alias, command) {
try {
if (!bundleShortId) {
bundleShortId = await promptAppBundle();
}
if (!alias) {
alias = await promptAppBundleAlias(bundleShortId);
}
await designAutomation.deleteAppBundleAlias(bundleShortId, alias);
} catch(err) {
error(err);
}
});

program
.command('delete-appbundle-version [bundle-short-id] [version]')
.alias('dbv')
.description('Delete app bundle version.')
.action(async function(bundleShortId, version, command) {
try {
if (!bundleShortId) {
bundleShortId = await promptAppBundle();
}
if (!version) {
version = await promptAppBundleVersion(bundleShortId);
}
await designAutomation.deleteAppBundleVersion(bundleShortId, parseInt(version));
} catch(err) {
error(err);
}
});

program
.command('list-activities')
.alias('la')
Expand Down Expand Up @@ -667,6 +718,57 @@ program
}
});

program
.command('delete-activity [activity-short-id]')
.alias('da')
.description('Delete activity with all its aliases and versions.')
.action(async function(activityShortId, command) {
try {
if (!activityShortId) {
activityShortId = await promptActivity();
}
await designAutomation.deleteActivity(activityShortId);
} catch(err) {
error(err);
}
});

program
.command('delete-activity-alias [activity-short-id] [alias]')
.alias('daa')
.description('Delete activity alias.')
.action(async function(activityShortId, alias, command) {
try {
if (!activityShortId) {
activityShortId = await promptActivity();
}
if (!alias) {
alias = await promptActivityAlias(activityShortId);
}
await designAutomation.deleteActivityAlias(activityShortId, alias);
} catch(err) {
error(err);
}
});

program
.command('delete-activity-version [activity-short-id] [version]')
.alias('dav')
.description('Delete activity version.')
.action(async function(activityShortId, version, command) {
try {
if (!activityShortId) {
activityShortId = await promptActivity();
}
if (!version) {
version = await promptActivityVersion(activityShortId);
}
await designAutomation.deleteActivityVersion(activityShortId, parseInt(version));
} catch(err) {
error(err);
}
});

let _workitemInputs = [];
let _workitemOutputs = [];

Expand Down Expand Up @@ -758,7 +860,7 @@ program

program
.command('get-workitem <workitem-id>')
.alias('cw')
.alias('gw')
.description('Get work item details.')
.option('-s, --short', 'Output work item status instead of the entire JSON.')
.action(async function(workitemId, command) {
Expand All @@ -774,6 +876,18 @@ program
}
});

program
.command('delete-workitem <workitem-id>')
.alias('dw')
.description('Delete work item.')
.action(async function(workitemId, command) {
try {
await designAutomation.deleteWorkItem(workitemId);
} catch(err) {
error(err);
}
});

program.parse(process.argv);
if (!program.args.length) {
program.help();
Expand Down
14 changes: 9 additions & 5 deletions src/forge-md.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ program
.description('Command-line tool for accessing Autodesk Forge Model Derivative service.');

program
.command('list-formats')
.command('list-formats [input-type]')
.alias('lf')
.description('List supported formats.')
.action(async function() {
.description('List supported output formats for specific input type or for all input types.')
.action(async function(inputType) {
try {
const formats = await modelDerivative.formats();
log(formats);
if (inputType) {
log(Object.keys(formats).filter(key => formats[key].includes(inputType)));
} else {
log(formats);
}
} catch(err) {
error(err);
}
Expand All @@ -48,7 +52,7 @@ program
.command('translate <urn>')
.alias('t')
.description('Start translation job.')
.option('-t, --type <type>', 'Output type ("svf" by default).', 'svf')
.option('-t, --type <type>', 'Output type ("svf" by default). See `forge-md list-formats` for all possible output types.', 'svf')
.option('-v, --views <views>', 'Comma-separated list of requested views ("2d,3d" by default)', '2d,3d')
.option('-w, --wait', 'Wait for the translation to complete.', false)
.action(async function(urn, command) {
Expand Down

0 comments on commit 527b400

Please sign in to comment.