Commit 2d9e86c
committed
fix(cli): menu infinite loop when picking sign-in (or anything with argv)
Picking 'Sign in to MIOSA' (or any non-docs option) caused the menu to
re-print indefinitely. Root cause in src/commands/menu.ts:
await program.parseAsync(['node', 'miosa', ...chosen.argv], { from: 'user' });
With { from: 'user' } Commander expects argv WITHOUT the node/script
prefix — just bare user-typed args. Passing ['node', 'miosa', 'login']
made Commander treat 'node' as the first positional, find no matching
subcommand, and fall through to THIS file's default program.action()
handler again — which IS the menu. The menu re-rendered, the user
picked again, parseAsync mis-parsed again, ad infinitum.
The docs option happened to work because it has an early return that
never touches parseAsync.
Fix:
- parseAsync(chosen.argv, { from: 'user' }) — correct encoding
- module-level menuActive flag — defense-in-depth guard that prints
help if the action is somehow re-entered
Bumped to 1.0.8.1 parent cd18ad4 commit 2d9e86c
3 files changed
Lines changed: 33 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
67 | 76 | | |
68 | 77 | | |
69 | 78 | | |
70 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
71 | 91 | | |
72 | 92 | | |
73 | 93 | | |
| |||
122 | 142 | | |
123 | 143 | | |
124 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
125 | 154 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 155 | + | |
129 | 156 | | |
130 | 157 | | |
0 commit comments