[Bug] `text` validate function for text when value is empty with default value
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- node.js, typescript
- Área
- cli
Línea de trabajo
Comienza con core/prompts/text y reproduce el caso de entrada vacía usando el ejemplo enlazado de StackBlitz. Revisa el borrador de PR #396 junto con las dos direcciones de solución propuestas. Se considera terminado cuando pulsar Enter con un valor predeterminado configurado hace que la validación use ese valor predeterminado, preservando al mismo tiempo el comportamiento documentado del prompt de texto.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment
- OS: macOS
- Node Version:
22.5.1 - Package:
@clack/promts - Package Version: 0.11.0
Describe the bug
When calling the text's validate function without user input but with a default value defined, it should use the default value instead of relying solely on user input.
To Reproduce
Steps to reproduce the behavior:
- Open repro link
- Run
node index.js - Don't type anything, just press
[Enter] - See behavior described on terminal
Expected behavior
Clear use case example:
CLI dev creates a text step for user to enter a path as input. There's some predefined value that CLI dev established to be the default use case for most users, but still allowing for that value to be changed.
Currently, the user would have to type/copy that entire path, causing a terrible user experience.
Fix Recommendation (starting a convo)
I see 2 possible ways to fix this:
- Keep
validateas is and add a check to the value oncore/prompts/text- link to draft PR - Add a second optional argument, which would be the default value to
validate. That way, Devs would have another quick option when using thevalidatefunction, without adding extra checks to thecorelibrary.
My goal with this section is to start a conversation and introduce my ideas about this issue, not a way for me to impose how I think things should be.
This would be my first contribution, so I'm pretty new here. Let me know what you think and hopefully let's get this fixed!
- Lenguaje dominante
- TypeScript
- Estrellas
- 8.1k
- Forks
- 217
- Merge medio
- 1 d 11 h
- PR fusionados (30 d)
- 5
Guía de contribución
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 bombshell-dev/clack
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
bombshell-dev/clack#597 ·
-
rfc: accessible mode Abiertoenhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
bombshell-dev/clack#585 · 1 comentario · 1 reacción ·
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
bombshell-dev/clack#573 · 1 comentario · 2 reacciones ·
-
enhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
bombshell-dev/clack#565 · 1 comentario · 1 reacción ·
-
[Request] Improve path selection Abiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
bombshell-dev/clack#564 · 1 reacción ·
Todos los issues de bombshell-dev/clack
Issues similares
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Crush Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
ElementsProject/cln-application#167 · 1 comentario · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Quantco/pnpm-licenses#17 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100