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

Commit 62de1b0

Browse files
authored
Add feedback for compose --deploy command (#46)
1 parent ae308c7 commit 62de1b0

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

bin/compose

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const composer = require('../composer')
99

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

12-
if (argv._.length !== 1) {
12+
if (argv._.length !== 1 || argv.deploy === '') {
1313
console.error('Usage: compose <composition.js[on]> [--deploy <name> | --encode] [--apihost <host>] [--auth <key>] [--insecure]')
1414
return
1515
}
@@ -21,7 +21,12 @@ if (argv.deploy) {
2121
const options = { ignore_certs: argv.insecure }
2222
if (argv.apihost) options.apihost = argv.apihost
2323
if (argv.auth) options.api_key = argv.auth
24-
composer.openwhisk(options).compositions.deploy(composition, argv.deploy).catch(console.error)
24+
const obj = composition.named(argv.deploy)
25+
composer.openwhisk(options).compositions.deploy(obj)
26+
.then(() => {
27+
const names = obj.actions.map(action => action.name)
28+
console.log(`ok: created action${names.length > 1 ? 's' : ''} ${names}`)
29+
}, console.error)
2530
} else if (argv.encode) {
2631
console.log(composition.encode('anonymous').actions.slice(-1)[0].action.exec.code)
2732
} else {

composer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ class Compositions {
125125
const obj = composition.encode(name)
126126
return obj.actions.reduce((promise, action) => promise.then(() => this.actions.delete(action).catch(() => { }))
127127
.then(() => this.actions.update(action)), Promise.resolve())
128-
.then(() => composition)
129128
}
130129
}
131130

0 commit comments

Comments
 (0)