Skip to content

Commit 42382ab

Browse files
committed
fix: stop using getopts in bin/codeflare
It does not support long-form options. I think we did this originally, because we were (originally) calling to the madwizard npm directly from the bin/codeflare shell script launcher.
1 parent d44406e commit 42382ab

File tree

2 files changed

+19
-40
lines changed

2 files changed

+19
-40
lines changed

bin/codeflare

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
#!/usr/bin/env bash
22
# -*- mode: shell-script
33

4-
export NODE_NO_WARNINGS=1
5-
6-
# use a special window sizing and positioning
7-
# export KUI_POPUP_WINDOW_RESIZE=true
8-
9-
# use a fixed popup window sizing of our choosing
10-
# export WINDOW_WIDTH=1024
11-
# export WIDTH_HEIGHT=768
12-
13-
# This tells the core Kui plugin resolver that we are using webpack to
14-
# build our headless bundles, not the old headless hacks
15-
export KUI_HEADLESS_WEBPACK=true
16-
174
SCRIPTDIR=$(cd $(dirname "$0") && pwd)
185

196
if [ -n "$NODE" ] && [ -n "$HEADLESS" ]; then
@@ -96,9 +83,6 @@ else
9683
exit 1
9784
fi
9885

99-
# This points the headless->electron launcher to our Electron
100-
export KUI_ELECTRON_HOME="${KUI_ELECTRON_HOME-$NODE}"
101-
10286
if [ -z "$GUIDEBOOK_STORE" ]; then
10387
if [ -d "$HEADLESS"/../../node_modules/@guidebooks/store/dist/store ]; then
10488
# development
@@ -115,31 +99,20 @@ if [ -z "$GUIDEBOOK_STORE" ]; then
11599
fi
116100
fi
117101

118-
do_cli=1
119-
use_docker=0
120-
while getopts "piqaydnVs:t:" opt
121-
do
122-
case $opt in
123-
d) use_docker=1; continue;;
124-
s) export GUIDEBOOK_STORE=$OPTARG; continue;;
125-
*) continue;;
126-
esac
127-
done
128-
# shift $((OPTIND-1))
102+
# launch headless version; here, we use madwizard directly, but
103+
# using electron as the nodejs binary (this is what
104+
# ELECTRON_RUN_AS_NODE does for us)
105+
export KUI_HEADLESS=true
106+
export KUI_S3=${KUI_S3-false} # we don't need plugin-s3 capabilities when in headless mode
107+
export ELECTRON_RUN_AS_NODE=true
129108

130-
if [ $use_docker = 1 ]; then
131-
# launch inside a docker container
132-
exec docker run -it --entrypoint ${ENTRYPOINT-codeflare} --rm -v /tmp:/tmp -v ~/.aws:/home/codeflare/.aws -v ~/.bluemix:/home/codeflare/.bluemix -v ~/.kube:/home/codeflare/.kube -e KUBECONFIG=$(echo $KUBECONFIG | sed "s/$USER/codeflare/g" | sed 's/Users/home/g') ghcr.io/project-codeflare/codeflare-cli -- $*
133-
fi
109+
# This tells the core Kui plugin resolver that we are using webpack to
110+
# build our headless bundles, not the old headless hacks. In the next
111+
# major semver of Kui, this should no longer be necessary.
112+
export KUI_HEADLESS_WEBPACK=true
134113

135-
if [ "$do_cli" = "1" ]; then
136-
# launch headless version; here, we use madwizard directly, but
137-
# using electron as the nodejs binary (this is what
138-
# ELECTRON_RUN_AS_NODE does for us)
139-
export KUI_HEADLESS=true
140-
export KUI_S3=${KUI_S3-false} # we don't need plugin-s3 capabilities when in headless mode
141-
export ELECTRON_RUN_AS_NODE=true
142-
fi
114+
# This points the headless->electron launcher to our Electron
115+
export KUI_ELECTRON_HOME="${KUI_ELECTRON_HOME-$NODE}"
143116

144117
# Linux may not have the prereqs needed to run Electron
145118
if [ "$NODE" != "node" ] && [ ! -f ~/.codeflare ] && [ $(uname) = Linux ]; then

plugins/plugin-madwizard/src/plugin.ts

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

1919
export interface Options extends ParsedOptions {
20+
/** Alternate guidebook store */
21+
s: string
22+
23+
/** Alternate guidebook store */
24+
store: string
25+
2026
/** Run in UI mode */
2127
u: boolean
2228

@@ -152,7 +158,7 @@ export function doMadwizard({ readonlyUI = true, task, withFilepath = true, cb,
152158
export const flags = {
153159
boolean: ["u", "V", "n", "q", "i", "y"],
154160
configuration: { "populate--": true },
155-
alias: { quiet: ["q"], interactive: ["i"], yes: ["y"], profile: ["p"], verbose: ["V"], team: ["t"] },
161+
alias: { store: ["s"], quiet: ["q"], interactive: ["i"], yes: ["y"], profile: ["p"], verbose: ["V"], team: ["t"] },
156162
}
157163

158164
/** Register Kui Commands */

0 commit comments

Comments
 (0)