cli: run command setup before fallback prompts
Los mantenedores suelen responder en 1 día
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 16.7k
- Forks
- 808
- Merge medio
- 11 h 31 min
- PR fusionados (30 d)
- 834
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
Xml: `positions` decode option that puts `line` and `column` on `StartElement` eventsPosiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#10400 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
effect/ai: support the MCP Apps extension (`io.modelcontextprotocol/ui`)Posiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#10399 · 2 comentarios · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Flat RPC client and AtomRpc query/mutation: type-check cost grows with RPCs in the group × tags calledPosiblemente ocupada @effect-bot la tomó hoy. Abierto
Effect-TS/effect#10396 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Support `format: "password"` as `Redacted` in JSON Schema import/export and the OpenAPI generatorPosiblemente ocupada @effect-bot la tomó hoy. Abiertoenhancement
Effect-TS/effect#10394 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Versioned schemas with version negotiation in HttpApi, Rpc and clusterPosiblemente ocupada @effect-bot la tomó hace 1 día. Abierto
Effect-TS/effect#10383 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
test-reliability
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Azure/azure-sdk-for-js#40672 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
HarperFast/studio#2067 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
liberation-data/drivine#639 · 2 comentarios ·
Los mantenedores suelen responder en 1 día