Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@adobe/aio-cli-plugin-runtime": "github:nimbella/aio-cli-plugin-runtime#v2021-11-19-1",
"@adobe/aio-lib-core-config": "^2.0.0",
"@adobe/aio-lib-runtime": "^3.3.0",
"@nimbella/nimbella-deployer": "4.2.1",
"@nimbella/nimbella-deployer": "4.3.2",
"@nimbella/storage": "^0.0.7",
"@oclif/command": "^1",
"@oclif/config": "^1",
Expand Down
34 changes: 16 additions & 18 deletions src/commands/action/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,31 @@
* governing permissions and limitations under the License.
*/

import { inBrowser } from '@nimbella/nimbella-deployer'
import { NimBaseCommand, NimLogger } from '../../NimBaseCommand'
import RuntimeBaseCommand from '@adobe/aio-cli-plugin-runtime/src/RuntimeBaseCommand'
import { prompt } from '../../ui'
import { flags } from '@oclif/command'
const AioCommand: typeof RuntimeBaseCommand = require('@adobe/aio-cli-plugin-runtime/src/commands/runtime/action/delete')
import { getCredentials, authPersister, deleteAction } from '@nimbella/nimbella-deployer'
import openwhisk from 'openwhisk'

export default class ActionDelete extends NimBaseCommand {
async runCommand(rawArgv: string[], argv: string[], args: any, flags: any, logger: NimLogger): Promise<void> {
if (inBrowser && flags.json) { // behave correctly when invoked from sidecar delete button
if (!flags.force) {
const ans = await prompt(`type 'yes' to really delete '${args.actionName}'`)
if (ans !== 'yes') {
logger.log('doing nothing')
return
}
}
const arg = args.actionName
const creds = await getCredentials(authPersister).catch(err => logger.handleError('', err))
const owClient = openwhisk(creds.ow)
const deletedAction = await deleteAction(arg, owClient)
if (flags.json) {
logger.logJSON(deletedAction)
}
await this.runAio(rawArgv, argv, args, flags, logger, AioCommand)
}

static args = AioCommand.args
static args = [
{
name: 'actionName',
required: true
}
]

static flags = {
force: flags.boolean({ char: 'f', description: 'Just do it, omitting confirmatory prompt' }),
...AioCommand.flags
...NimBaseCommand.flags // includes json flag
}

static description = AioCommand.description
static description = 'deletes an action'
}