Skip to content

Commit dc0b02d

Browse files
committed
fix: support passing through --no-profile (via -n) option to madwizard
e.g. ```shell codeflare -n -V ml/codeflare ``` which would run with no-profile mode (-n) meaning codeflare will not use remembered choices; and with verbose output (-V)
1 parent bcd326e commit dc0b02d

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

bin/codeflare

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,16 @@ fi
110110
# check if the user wants us to run the graphical version (currently
111111
# indicated by the -u option)
112112
do_cli=1
113-
while getopts "Vus:" opt
113+
while getopts "nVus:" opt
114114
do
115115
case $opt in
116-
(u) do_cli=0; shift; continue;;
117-
(s) GUIDEBOOK_STORE=$OPTARG; shift; shift; continue;;
118-
(V) EXTRAPREFIX="-V"; shift; continue;;
116+
(u) do_cli=0; continue;;
117+
(s) GUIDEBOOK_STORE=$OPTARG; continue;;
118+
(n) EXTRAPREFIX="$EXTRAPREFIX -n"; continue;;
119+
(V) EXTRAPREFIX="$EXTRAPREFIX -V"; continue;;
119120
esac
120121
done
122+
shift $((OPTIND-1))
121123

122124
if [ $# = 0 ] || [ $# = 1 ] && [ "$1" != "version" ]; then
123125
# use the "guide" command if none was given

plugins/plugin-madwizard/src/plugin.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import { Arguments, ParsedOptions, ReactResponse, Registrar, Tab } from "@kui-shell/core"
1818

1919
interface Options extends ParsedOptions {
20+
/** Run in UI mode */
2021
u: boolean
2122

23+
/** verbose output */
2224
V: boolean
25+
26+
/** do not load prior choices (the default "profile") */
27+
n: boolean
2328
}
2429

2530
// TODO export this from madwizard
@@ -38,7 +43,7 @@ function withFilepath(
3843
if (!parsedOptions.u) {
3944
// CLI path
4045
const { cli } = await import("madwizard/dist/fe/cli/index.js")
41-
await cli(["madwizard", task, ...argvNoOptions.slice(1)], undefined, { store: process.env.GUIDEBOOK_STORE, verbose: parsedOptions.V })
46+
await cli(["madwizard", task, ...argvNoOptions.slice(1), ...(parsedOptions.n ? ['--no-profile'] : [])], undefined, { store: process.env.GUIDEBOOK_STORE, verbose: parsedOptions.V })
4247
return true
4348
}
4449

@@ -56,7 +61,7 @@ function withFilepath(
5661
/** Register Kui Commands */
5762
export default function registerMadwizardCommands(registrar: Registrar) {
5863
const flags = {
59-
boolean: ["u", "V"],
64+
boolean: ["u", "V", "n"],
6065
}
6166

6267
registrar.listen(

0 commit comments

Comments
 (0)