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

Commit a6134b2

Browse files
committed
feat(plugins/plugin-core-support): replay --close-current-tab
Fixes #5929
1 parent 7ed98d9 commit a6134b2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

plugins/plugin-client-notebook/src/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export default function renderMain(props: KuiProps) {
4949
splitTerminals
5050
lightweightTables
5151
{...props}
52-
commandLine={props.commandLine || ['replay', '/kui/welcome.json', '--status-stripe', 'default']}
52+
commandLine={
53+
props.commandLine || ['replay', '/kui/welcome.json', '--close-current-tab', '--status-stripe', 'default']
54+
}
5355
loadingDone={() => undefined}
5456
>
5557
<ContextWidgets>{kuiVersion()}</ContextWidgets>

plugins/plugin-core-support/src/lib/cmds/replay.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ const replayUsage = {
4040
optional: [
4141
{ name: '--freshen', alias: '-f', boolean: true, docs: 'Regenerate snapshot' },
4242
{ name: '--new-window', alias: '-w', boolean: true, docs: 'Replay in a new window (Electron only)' },
43+
{ name: '--close-current-tab', alias: '-c', boolean: true, docs: 'Also close the current tab' },
4344
{ name: '--status-stripe', docs: 'Modify status stripe', allowed: ['default', 'blue', 'yellow', 'red'] }
4445
]
4546
},
4647
flags: {
47-
boolean: ['new-window', 'w', 'freshen', 'f']
48+
boolean: ['new-window', 'w', 'freshen', 'f', 'close-current-tab', 'c']
4849
}
4950
}
5051

@@ -114,6 +115,11 @@ export default function(registrar: Registrar) {
114115
// avoid pulling in electron for purely browser-based clients
115116
return REPL.qexec(`replay-electron ${filepath}`)
116117
} else {
118+
if (parsedOptions['close-current-tab'] || parsedOptions.c) {
119+
// see https://github.com/IBM/kui/issues/5929
120+
await REPL.qexec('tab close')
121+
}
122+
117123
return REPL.qexec(
118124
`tab new --snapshot "${filepath}" --quiet --status-stripe-type ${parsedOptions['status-stripe'] ||
119125
'blue'} ${titleOption}`,

0 commit comments

Comments
 (0)