Skip to content

Commit e2539cb

Browse files
starpitk8s-ci-robot
authored andcommitted
fix: remove kubeui command prefix
Part of kubernetes-sigs#7314
1 parent b32a940 commit e2539cb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+93
-215
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
{
2-
"defaultContext": ["kubeui"]
3-
}
1+
{}

plugins/plugin-kubectl/helm/src/controller/command-prefix.ts

-25
This file was deleted.

plugins/plugin-kubectl/helm/src/controller/helm/catchall.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { inBrowser, hasProxy, Arguments, Registrar } from '@kui-shell/core'
1818
import { isUsage, doHelp, KubeOptions } from '@kui-shell/plugin-kubectl'
1919

2020
import doExecWithPty from './exec'
21-
import commandPrefix from '../command-prefix'
2221

2322
/** is the given string `str` the `helm` command? */
2423
const isHelm = (str: string) => /^helm$/.test(str)
@@ -34,15 +33,9 @@ export default (registrar: Registrar) => {
3433
// found exceptions to the outer shell
3534
//
3635
registrar.catchall(
37-
(argv: string[]) => {
38-
return isHelm(argv[0]) || (argv[0] === commandPrefix && isHelm(argv[1]))
39-
},
36+
(argv: string[]) => isHelm(argv[0]),
4037
(args: Arguments<KubeOptions>) =>
41-
isUsage(args) ||
42-
(args.argv.length === 1 && args.argv[0] === 'helm') ||
43-
(args.argv.length === 2 && args.argv[1] === 'helm' && args.argv[0] === commandPrefix)
44-
? doHelp('helm', args)
45-
: doExecWithPty(args),
38+
isUsage(args) || (args.argv.length === 1 && args.argv[0] === 'helm') ? doHelp('helm', args) : doExecWithPty(args),
4639
1 // priority
4740
)
4841
}

plugins/plugin-kubectl/helm/src/controller/helm/get.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { doHelp, KubeOptions } from '@kui-shell/plugin-kubectl'
2020
import isUsage from './usage'
2121
import doExecWithStdout from './exec'
2222
import apiVersion from './apiVersion'
23-
import commandPrefix from '../command-prefix'
2423
import { HelmRelease } from '../../models/release'
2524

2625
// TODO: this needs to be updated to parse out helm v3 responses
@@ -77,5 +76,5 @@ async function doGet(
7776
}
7877

7978
export default (registrar: Registrar) => {
80-
registrar.listen(`/${commandPrefix}/helm/get`, doGet)
79+
registrar.listen('/helm/get', doGet)
8180
}

plugins/plugin-kubectl/helm/src/controller/helm/history.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { doHelp, preprocessTable, formatTable, KubeOptions } from '@kui-shell/pl
1919

2020
import isUsage from './usage'
2121
import doExecWithStdout from './exec'
22-
import commandPrefix from '../command-prefix'
2322

2423
async function doHistory(args: Arguments<KubeOptions>) {
2524
if (isUsage(args, 'history')) {
@@ -33,5 +32,5 @@ async function doHistory(args: Arguments<KubeOptions>) {
3332
}
3433

3534
export default (registrar: Registrar) => {
36-
registrar.listen(`/${commandPrefix}/helm/history`, doHistory)
35+
registrar.listen('/helm/history', doHistory)
3736
}

plugins/plugin-kubectl/helm/src/controller/helm/install.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { doHelp, getNamespaceForArgv, KubeOptions } from '@kui-shell/plugin-kube
1919

2020
import isUsage from './usage'
2121
import doExecWithStdout from './exec'
22-
import commandPrefix from '../command-prefix'
2322

2423
const name = /^NAME:\s+([\w-]+)/
2524

@@ -41,5 +40,5 @@ async function doInstall(args: Arguments<KubeOptions>) {
4140
}
4241

4342
export default (registrar: Registrar) => {
44-
registrar.listen(`/${commandPrefix}/helm/install`, doInstall)
43+
registrar.listen('/helm/install', doInstall)
4544
}

plugins/plugin-kubectl/helm/src/controller/helm/list.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { Arguments, Registrar } from '@kui-shell/core'
1818
import { isUsage, doHelp, preprocessTable, formatTable, KubeOptions } from '@kui-shell/plugin-kubectl'
1919

2020
import doExecWithStdout from './exec'
21-
import commandPrefix from '../command-prefix'
2221

2322
async function doList(args: Arguments<KubeOptions>) {
2423
if (isUsage(args)) {
@@ -37,7 +36,6 @@ async function doList(args: Arguments<KubeOptions>) {
3736
}
3837

3938
export default (registrar: Registrar) => {
40-
registrar.listen(`/${commandPrefix}/helm/list`, doList)
41-
42-
registrar.listen(`/${commandPrefix}/helm/ls`, doList)
39+
registrar.listen('/helm/ls', doList)
40+
registrar.listen('/helm/list', doList)
4341
}

plugins/plugin-kubectl/helm/src/controller/helm/raw.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import { Registrar } from '@kui-shell/core'
1818
import { doNativeExec, defaultFlags } from '@kui-shell/plugin-kubectl'
1919

20-
import commandPrefix from '../command-prefix'
21-
2220
export default async (registrar: Registrar) => {
23-
registrar.listen(`/${commandPrefix}/_helm`, doNativeExec, Object.assign({}, defaultFlags, { requiresLocal: true }))
21+
registrar.listen('/_helm', doNativeExec, Object.assign({}, defaultFlags, { requiresLocal: true }))
2422
}

plugins/plugin-kubectl/helm/src/controller/helm/repo.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { doHelp, preprocessTable, formatTable, KubeOptions } from '@kui-shell/pl
1919

2020
import isUsage from './usage'
2121
import doExecWithStdout from './exec'
22-
import commandPrefix from '../command-prefix'
2322

2423
async function doRepoList(args: Arguments<KubeOptions>) {
2524
if (isUsage(args, 'repo')) {
@@ -33,7 +32,6 @@ async function doRepoList(args: Arguments<KubeOptions>) {
3332
}
3433

3534
export default (registrar: Registrar) => {
36-
registrar.listen(`/${commandPrefix}/helm/repo/list`, doRepoList)
37-
38-
registrar.listen(`/${commandPrefix}/helm/repo/ls`, doRepoList)
35+
registrar.listen('/helm/repo/ls', doRepoList)
36+
registrar.listen('/helm/repo/list', doRepoList)
3937
}

plugins/plugin-kubectl/helm/src/controller/helm/search.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { doHelp, preprocessTable, formatTable, KubeOptions } from '@kui-shell/pl
1919

2020
import isUsage from './usage'
2121
import doExecWithStdout from './exec'
22-
import commandPrefix from '../command-prefix'
2322

2423
async function doSearch(args: Arguments<KubeOptions>) {
2524
if (isUsage(args, 'search')) {
@@ -33,5 +32,5 @@ async function doSearch(args: Arguments<KubeOptions>) {
3332
}
3433

3534
export default (registrar: Registrar) => {
36-
registrar.listen(`/${commandPrefix}/helm/search`, doSearch)
35+
registrar.listen('/helm/search', doSearch)
3736
}

plugins/plugin-kubectl/helm/src/controller/helm/status.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { doHelp, KubeOptions } from '@kui-shell/plugin-kubectl'
2020

2121
import isUsage from './usage'
2222
import doExecWithStdout from './exec'
23-
import commandPrefix from '../command-prefix'
2423

2524
const strings = i18n('plugin-kubectl')
2625
const strings2 = i18n('plugin-kubectl', 'helm')
@@ -202,5 +201,5 @@ async function doStatus(args: Arguments<KubeOptions>) {
202201
}
203202

204203
export default (registrar: Registrar) => {
205-
registrar.listen(`/${commandPrefix}/helm/status`, doStatus)
204+
registrar.listen('/helm/status', doStatus)
206205
}

plugins/plugin-kubectl/krew/src/plugin.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { Registrar } from '@kui-shell/core'
18-
import { defaultFlags, commandPrefix } from '@kui-shell/plugin-kubectl'
18+
import { defaultFlags } from '@kui-shell/plugin-kubectl'
1919

2020
import help from './controller/krew/help'
2121
import info from './controller/krew/info'
@@ -29,12 +29,12 @@ const canonical = 'kubectl'
2929

3030
export default async (registrar: Registrar) => {
3131
aliases.forEach(command => {
32-
registrar.listen(`/${commandPrefix}/${command}/krew/help`, help(canonical), defaultFlags)
33-
registrar.listen(`/${commandPrefix}/${command}/krew/info`, info(canonical), defaultFlags)
34-
registrar.listen(`/${commandPrefix}/${command}/krew/list`, list(canonical), defaultFlags)
35-
registrar.listen(`/${commandPrefix}/${command}/krew/search`, genericTable(canonical), defaultFlags)
36-
registrar.listen(`/${commandPrefix}/${command}/krew/version`, genericTable(canonical), defaultFlags)
32+
registrar.listen(`/${command}/krew/help`, help(canonical), defaultFlags)
33+
registrar.listen(`/${command}/krew/info`, info(canonical), defaultFlags)
34+
registrar.listen(`/${command}/krew/list`, list(canonical), defaultFlags)
35+
registrar.listen(`/${command}/krew/search`, genericTable(canonical), defaultFlags)
36+
registrar.listen(`/${command}/krew/version`, genericTable(canonical), defaultFlags)
3737

38-
registrar.listen(`/${commandPrefix}/${command}/popeye`, popeye(canonical), defaultFlags)
38+
registrar.listen(`/${command}/popeye`, popeye(canonical), defaultFlags)
3939
})
4040
}

plugins/plugin-kubectl/logs/src/controller/kubectl/logs.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ import {
3838
isPod
3939
} from '@kui-shell/plugin-kubectl'
4040

41-
import commandPrefix from '../command-prefix'
42-
4341
const strings = i18n('plugin-kubectl', 'logs')
4442

4543
interface LogOptions extends KubeOptions {
@@ -182,11 +180,11 @@ const doExec = getOrPty('exec')
182180
const execFlags = Object.assign({}, defaultFlags, { viewTransformer: viewTransformer('terminal') })
183181

184182
export function registerLogs(registrar: Registrar, cmd: string) {
185-
registrar.listen(`/${commandPrefix}/${cmd}/logs`, doLogs, logsFlags)
183+
registrar.listen(`/${cmd}/logs`, doLogs, logsFlags)
186184
}
187185

188186
export function registerExec(registrar: Registrar, cmd: string) {
189-
registrar.listen(`/${commandPrefix}/${cmd}/exec`, doExec, execFlags)
187+
registrar.listen(`/${cmd}/exec`, doExec, execFlags)
190188
}
191189

192190
export default (registrar: Registrar) => {

plugins/plugin-kubectl/oc/src/controller/exec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616

1717
import { Arguments } from '@kui-shell/core'
18-
import { doExecWithStdout, KubeOptions, commandPrefix } from '@kui-shell/plugin-kubectl'
18+
import { doExecWithStdout, KubeOptions } from '@kui-shell/plugin-kubectl'
1919

2020
export default function doExec<O extends KubeOptions>(args: Arguments<O>) {
21-
const cmd = args.argv[0] === commandPrefix ? args.argv[1] : args.argv[0]
21+
const cmd = args.argv[0]
2222
return doExecWithStdout(args, undefined, cmd)
2323
}

plugins/plugin-kubectl/oc/src/controller/kubectl/catchall.ts

+3-12
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,7 @@
1515
*/
1616

1717
import { inBrowser, hasProxy, Arguments, Registrar, i18n } from '@kui-shell/core'
18-
import {
19-
doExecWithPty,
20-
doExecWithMarkdown,
21-
commandPrefix,
22-
isUsage,
23-
doHelp,
24-
KubeOptions
25-
} from '@kui-shell/plugin-kubectl'
18+
import { doExecWithPty, doExecWithMarkdown, isUsage, doHelp, KubeOptions } from '@kui-shell/plugin-kubectl'
2619

2720
const strings = i18n('plugin-kubectl')
2821

@@ -40,11 +33,9 @@ export default (registrar: Registrar) => {
4033
// found exceptions to the outer shell
4134
//
4235
registrar.catchall(
43-
(argv: string[]) => {
44-
return isOc(argv[0]) || (argv[0] === commandPrefix && isOc(argv[1]))
45-
},
36+
(argv: string[]) => isOc(argv[0]),
4637
async (args: Arguments<KubeOptions>) => {
47-
const cmd = args.argv[0] === commandPrefix ? args.argv[1] : args.argv[0]
38+
const cmd = args.argv[0]
4839

4940
if (args.argv.length === 1 || (args.argv.length === 2 && args.argv[1] === cmd)) {
5041
// `oc` or `odo` on their own

plugins/plugin-kubectl/oc/src/controller/kubectl/delegates.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import { Registrar } from '@kui-shell/core'
1818

1919
import {
20-
commandPrefix,
2120
defaultFlags,
2221
doCreate,
2322
getter,
@@ -34,10 +33,10 @@ import { registerLogs, registerExec } from '@kui-shell/plugin-kubectl/logs'
3433
const command = 'oc'
3534

3635
export default (registrar: Registrar) => {
37-
registrar.listen(`/${commandPrefix}/${command}/apply`, doCreate('apply', command), defaultFlags)
38-
registrar.listen(`/${commandPrefix}/${command}/create`, doCreate('create', command), defaultFlags)
39-
registrar.listen(`/${commandPrefix}/${command}/delete`, doDelete(command), defaultFlags)
40-
registrar.listen(`/${commandPrefix}/${command}/run`, doRun(command), defaultFlags)
36+
registrar.listen(`/${command}/apply`, doCreate('apply', command), defaultFlags)
37+
registrar.listen(`/${command}/create`, doCreate('create', command), defaultFlags)
38+
registrar.listen(`/${command}/delete`, doDelete(command), defaultFlags)
39+
registrar.listen(`/${command}/run`, doRun(command), defaultFlags)
4140

4241
getter(registrar, command)
4342
describer(registrar, command)

plugins/plugin-kubectl/oc/src/controller/oc/get/projects.ts

+4-10
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,11 @@
1515
*/
1616

1717
import { Registrar } from '@kui-shell/core'
18-
import {
19-
defaultFlags,
20-
commandPrefix,
21-
doGet,
22-
doExecWithStdout,
23-
emitKubectlConfigChangeEvent
24-
} from '@kui-shell/plugin-kubectl'
18+
import { defaultFlags, doGet, doExecWithStdout, emitKubectlConfigChangeEvent } from '@kui-shell/plugin-kubectl'
2519

2620
// we use the fetcher from 'kubectl get', and the viewTransformer from 'kubectl get namespaces'
2721
export default function registerOcProjectGet(registrar: Registrar) {
28-
registrar.listen(`/${commandPrefix}/oc/project`, async args => {
22+
registrar.listen('/oc/project', async args => {
2923
const response = await doExecWithStdout(args, undefined, 'oc')
3024

3125
const newNamespace = args.argvNoOptions[args.argvNoOptions.indexOf('project') + 1]
@@ -37,13 +31,13 @@ export default function registerOcProjectGet(registrar: Registrar) {
3731
})
3832

3933
registrar.listen(
40-
`/${commandPrefix}/oc/projects`,
34+
'/oc/projects',
4135
args => args.REPL.qexec('oc get projects', undefined, undefined, args.execOptions),
4236
defaultFlags
4337
)
4438

4539
const aliases = ['project', 'projects', 'ns', 'namespace', 'namespaces']
4640
aliases.forEach(ns => {
47-
registrar.listen(`/${commandPrefix}/oc/get/${ns}`, doGet('oc'), defaultFlags)
41+
registrar.listen(`/oc/get/${ns}`, doGet('oc'), defaultFlags)
4842
})
4943
}

plugins/plugin-kubectl/oc/src/controller/oc/login.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
*/
1616

1717
import { Registrar } from '@kui-shell/core'
18-
import { doExecWithPty, commandPrefix, emitKubectlConfigChangeEvent } from '@kui-shell/plugin-kubectl'
18+
import { doExecWithPty, emitKubectlConfigChangeEvent } from '@kui-shell/plugin-kubectl'
1919

2020
export default function registerOcLogin(registrar: Registrar) {
21-
registrar.listen(`/${commandPrefix}/oc/login`, async args => {
21+
registrar.listen('/oc/login', async args => {
2222
const response = await doExecWithPty(args)
2323
emitKubectlConfigChangeEvent('SetNamespaceOrContext')
2424
return response

plugins/plugin-kubectl/oc/src/controller/raw.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616

1717
import { Registrar } from '@kui-shell/core'
18-
import { doNativeExec, defaultFlags, commandPrefix } from '@kui-shell/plugin-kubectl'
18+
import { doNativeExec, defaultFlags } from '@kui-shell/plugin-kubectl'
1919

2020
export default async (registrar: Registrar) => {
21-
registrar.listen(`/${commandPrefix}/_oc`, doNativeExec, Object.assign({}, defaultFlags, { requiresLocal: true }))
21+
registrar.listen('/_oc', doNativeExec, Object.assign({}, defaultFlags, { requiresLocal: true }))
2222
}

plugins/plugin-kubectl/odo/src/controller/raw.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
*/
1616

1717
import { Registrar } from '@kui-shell/core'
18-
import { doNativeExec, defaultFlags, commandPrefix } from '@kui-shell/plugin-kubectl'
18+
import { doNativeExec, defaultFlags } from '@kui-shell/plugin-kubectl'
1919

2020
export default async (registrar: Registrar) => {
21-
registrar.listen(`/${commandPrefix}/_odo`, doNativeExec, Object.assign({}, defaultFlags, { requiresLocal: true }))
21+
registrar.listen('/_odo', doNativeExec, Object.assign({}, defaultFlags, { requiresLocal: true }))
2222
}

plugins/plugin-kubectl/odo/src/plugin.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { Arguments, KResponse, Registrar } from '@kui-shell/core'
1818

19-
import { isUsage, doHelp, commandPrefix, defaultFlags, KubeOptions } from '@kui-shell/plugin-kubectl'
19+
import { isUsage, doHelp, defaultFlags, KubeOptions } from '@kui-shell/plugin-kubectl'
2020

2121
import raw from './controller/raw'
2222

@@ -39,11 +39,11 @@ export default (registrar: Registrar) => {
3939
raw(registrar)
4040

4141
registrar.listen(
42-
`/${commandPrefix}/odo/project/list`,
42+
'/odo/project/list',
4343
withHelp(projectList),
4444
Object.assign({}, defaultFlags, { viewTransformer: projectListView })
4545
)
4646

47-
registrar.listen(`/${commandPrefix}/odo/catalog/list/components`, withHelp(catalogListComponents), defaultFlags)
48-
registrar.listen(`/${commandPrefix}/odo/catalog/list/services`, withHelp(catalogListServices), defaultFlags)
47+
registrar.listen('/odo/catalog/list/components', withHelp(catalogListComponents), defaultFlags)
48+
registrar.listen('/odo/catalog/list/services', withHelp(catalogListServices), defaultFlags)
4949
}

0 commit comments

Comments
 (0)