Skip to content

Commit 42d30fd

Browse files
committed
fix: catchall handler does not handle boolean flags
1 parent b32d7ab commit 42d30fd

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

plugins/plugin-codeflare/src/controller/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { KResponse, Registrar } from "@kui-shell/core"
18-
import { MadWizardOptions } from "@kui-shell/plugin-madwizard"
18+
import { MadWizardOptions, flags } from "@kui-shell/plugin-madwizard"
1919

2020
import { width, height } from "@kui-shell/client/config.d/style.json"
2121

@@ -100,6 +100,6 @@ export default function registerCodeflareCommands(registrar: Registrar) {
100100
(argv: string[]) => argv[0] === "codeflare",
101101
(args) => import("./catchall").then((_) => _.default(args)),
102102
1,
103-
{ flags: { configuration: { "populate--": true } } }
103+
{ flags }
104104
)
105105
}

plugins/plugin-madwizard/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
*/
1616

1717
export { setTabReadonly } from "./util"
18-
export { doMadwizard, Options as MadWizardOptions } from "./plugin"
18+
export { doMadwizard, flags, Options as MadWizardOptions } from "./plugin"

plugins/plugin-madwizard/src/plugin.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ export function doMadwizard(
7878
}
7979

8080
// decide which profile to use
81-
const profile =
82-
parsedOptions.p ||
83-
parsedOptions.profile || // specified on command line
84-
(await import("madwizard").then((_) => _.Profiles.lastUsed())) || // last used profile
85-
"default" // the default, if no lastUsed is found!
81+
const profile = parsedOptions.n
82+
? undefined
83+
: parsedOptions.p ||
84+
parsedOptions.profile || // specified on command line
85+
(await import("madwizard").then((_) => _.Profiles.lastUsed())) || // last used profile
86+
"default" // the default, if no lastUsed is found!
8687

8788
await cli(
8889
[
@@ -119,14 +120,14 @@ export function doMadwizard(
119120
}
120121
}
121122

123+
export const flags = {
124+
boolean: ["u", "V", "n", "q", "i", "y"],
125+
configuration: { "populate--": true },
126+
alias: { quiet: ["q"], interactive: ["i"], yes: ["y"], profile: ["p"], verbose: ["V"] },
127+
}
128+
122129
/** Register Kui Commands */
123130
export default function registerMadwizardCommands(registrar: Registrar) {
124-
const flags = {
125-
boolean: ["u", "V", "n", "q", "i", "y"],
126-
configuration: { "populate--": true },
127-
alias: { quiet: ["q"], interactive: ["i"], yes: ["y"], profile: ["p"], verbose: ["V"] },
128-
}
129-
130131
registrar.listen("/profile", doMadwizard(true, "profile"))
131132

132133
registrar.listen(

0 commit comments

Comments
 (0)