diff --git a/plugins/plugin-kubectl/oc/src/controller/oc/login.ts b/plugins/plugin-kubectl/oc/src/controller/oc/login.ts index 9c798bc3134..d7046bc92b5 100644 --- a/plugins/plugin-kubectl/oc/src/controller/oc/login.ts +++ b/plugins/plugin-kubectl/oc/src/controller/oc/login.ts @@ -19,6 +19,16 @@ import { doExecWithPty, emitKubectlConfigChangeEvent } from '@kui-shell/plugin-k export default function registerOcLogin(registrar: Registrar) { registrar.listen('/oc/login', async args => { + const command = args.command.replace(/login/, '_login') + const response = await args.REPL.qexec(command) + emitKubectlConfigChangeEvent('SetNamespaceOrContext') + return response + }) + + registrar.listen('/oc/_login', async args => { + args.command = args.command.replace(/_login/, 'login') + args.argvNoOptions[1] = 'login' + args.argv[1] = 'login' const response = await doExecWithPty(args) emitKubectlConfigChangeEvent('SetNamespaceOrContext') return response