cli: run command setup before fallback prompts
I maintainer di solito rispondono entro 1 giorno
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
What is the problem this feature would solve?
Flag.withFallbackPrompt asks its question while flags are parsed, which happens before any Command.provide* hook runs. So a command cannot show anything before its first question: no introduction, no notice, no consent question that must come first. Reproduced on 4.0.7:
const ask = (name: string) =>
Flag.String(name).pipe(Flag.withFallbackPrompt(Prompt.String({ message: `${name}?` })))
const demo = Command.make("demo", { name: ask("name"), dir: ask("dir") }, (input) =>
Console.log(input)
).pipe(Command.provideEffectDiscard(Console.log("Welcome to demo")))
Run without flags, both questions appear before Welcome to demo, and if the second prompt is cancelled the welcome never prints. To keep an introduction first today, a command has to drop fallback prompts and ask inside its handler, re-implementing the flag-then-prompt-then-fail logic that withFallbackPrompt now covers, including the canPrompt check from #9876.
What is the feature you are proposing to solve the problem?
A hook that runs after parsing has succeeded and before any fallback prompt, for example:
Command.beforePrompts(Console.log("Welcome to demo"))
Parse errors would still be reported before it runs, so a mistyped flag never shows the introduction, and fallback prompts would follow it in declaration order. It would run once per invocation, and also when every value was given as a flag, so the introduction does not depend on whether anything is asked.
What alternatives have you considered?
- Running the existing
Command.provide*hooks before fallback prompts: simpler to describe, but it changes ordering for every command that uses them, for example opening a resource before the user has answered anything. - Prompting inside the handler: what we do today; it gives up
withFallbackPromptand its newcanPrompthandling. - Printing the introduction before
Command.run: it would then also appear for--help,--versionand parse errors.
- Lingua principale
- TypeScript
- Stelle
- 16.7k
- Fork
- 808
- Merge medio
- 10h 17m
- PR unite (30g)
- 850
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Effect-TS/effect
-
[email protected]: crypto declarations require a global CryptoKey type, breaking Node-only type-checks with @types/node 22 and 24Forse già presa @effect-bot l’ha presa oggi. Apertabug
Effect-TS/effect#10196 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
OpenApi.fromApi (4.1.0) emits duplicate component schemas with a _1 suffix when the encoded side differsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
cluster: a runner that lost its shard lock can still write replies and messages for that shardAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 47/100
I maintainer di solito rispondono entro 1 giorno
-
`fromJsonSchemaDocument`: import open `patternProperties`Forse già presa @effect-bot l’ha presa 2 giorni fa. Aperta
Effect-TS/effect#10048 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Effect-TS/effect
Issue simili
-
Replace discontinued crypto-js in the themeForse già presa @aelmanaa l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
PaloAltoNetworks/docusaurus-openapi-docs#1689 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
solana-foundation/solana-web3.js#4015 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
formatSearchQuery drops the :present modifier, so `email:present=true` is sent as `email=true`Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 1/5 1-3 ore Idoneità per principianti 90/100
ivopogace/opencode-courier#422 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
chapel-lang/chapel-vscode#158 ·
I maintainer di solito rispondono entro 1 giorno