Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 9c62081

Browse files
committed
Add compose --encode option
1 parent 9bb45cf commit 9c62081

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bin/compose

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ const vm = require('vm')
77
const minimist = require('minimist')
88
const composer = require('../composer')
99

10-
const argv = minimist(process.argv.slice(2), { string: ['apihost', 'auth', 'deploy'], boolean: 'insecure', alias: { auth: 'u', insecure: 'i' } })
10+
const argv = minimist(process.argv.slice(2), { string: ['apihost', 'auth', 'deploy'], boolean: ['insecure', 'encode'], alias: { auth: 'u', insecure: 'i' } })
1111

1212
if (argv._.length !== 1) {
13-
console.error('Usage: compose <composition.js[on]> [--deploy <name>] [--apihost <host>] [--auth <key>] [--insecure]')
13+
console.error('Usage: compose <composition.js[on]> [--deploy <name> | --encode] [--apihost <host>] [--auth <key>] [--insecure]')
1414
return
1515
}
1616

@@ -22,6 +22,8 @@ if (argv.deploy) {
2222
if (argv.apihost) options.apihost = argv.apihost
2323
if (argv.auth) options.api_key = argv.auth
2424
composer.openwhisk(options).compositions.deploy(composition, argv.deploy).catch(console.error)
25+
} else if (argv.encode) {
26+
console.log(composition.encode('anonymous').actions.slice(-1)[0].action.exec.code)
2527
} else {
2628
console.log(JSON.stringify(composition, null, 4))
2729
}

0 commit comments

Comments
 (0)