Skip to content

Commit

Permalink
fix: clicking on container name in details sidecar should add -c to l…
Browse files Browse the repository at this point in the history
…ogs command

Also delegats oc logs to kubectl

Fixes #4498
  • Loading branch information
myan9 committed May 13, 2020
1 parent a716bdc commit efb5c12
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/plugin-kubectl/logs/src/controller/kubectl/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function decorateLogLines(lines: string): string {
* some ANSI control codes for coloring.
*
*/
async function doLogs(args: Arguments<LogOptions>) {
export async function doLogs(args: Arguments<LogOptions>) {
if (isUsage(args)) {
// special case: get --help/-h
return doHelp('kubectl', args)
Expand Down
1 change: 1 addition & 0 deletions plugins/plugin-kubectl/logs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
*/

// this file defines the external API
export { doLogs } from './controller/kubectl/logs'
2 changes: 2 additions & 0 deletions plugins/plugin-kubectl/oc/src/controller/kubectl/delegates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
doEdit,
doRun
} from '@kui-shell/plugin-kubectl'
import { doLogs } from '@kui-shell/plugin-kubectl/logs'

const command = 'oc'

Expand All @@ -34,6 +35,7 @@ export default (registrar: Registrar) => {
registrar.listen(`/${commandPrefix}/${command}/create`, doCreate('create', command), crudFlags)
registrar.listen(`/${commandPrefix}/${command}/delete`, doDelete(command), crudFlags)
registrar.listen(`/${commandPrefix}/${command}/edit`, doEdit(command), defaultFlags)
registrar.listen(`/${commandPrefix}/${command}/logs`, doLogs, defaultFlags)
registrar.listen(`/${commandPrefix}/${command}/run`, doRun(command), crudFlags)

getter(registrar, command)
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugin-kubectl/src/lib/view/modes/containers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const showLogs = (tab: Tab, { pod, container }, args: { argvNoOptions: string[]
const containerName = encodeComponent(container.name)
const ns = encodeComponent(pod.metadata.namespace)

return `${getCommandFromArgs(args)} logs ${podName} ${containerName} -n ${ns}`
return `${getCommandFromArgs(args)} logs ${podName} -c ${containerName} -n ${ns}`
}

/**
Expand Down

0 comments on commit efb5c12

Please sign in to comment.