felangel / felangel/mason

feat: input variable as default for subsequent input variables

Abierto
#798 1 comentario 3 reacciones 0 asignados Ver en GitHub
enhancement candidate
Lenguaje dominante
Dart
Estrellas
1.1k
Forks
113
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Description**

While creating a brick that takes multiple inputs, I would like a previously entered input to be usable as a default value for subsequent variable inputs.

Say I'm creating a custom bloc brick that adds a bloc structure to one of my app's pages. Currently I would write something like this:

```yaml
name: my_custom_bloc
description: Generate a new custom Bloc in Dart
version: 0.1.0+1

environment:
mason: ">=0.1.0-dev.32 <0.1.0"

vars:
page:
type: string
description: The name of the page containing the future bloc.
default: login
prompt: What is the page name?
bloc:
type: string
description: The name of the bloc class.
# This input default could be set to what has already been entered for a previous variable
default: login
prompt: What is the bloc name?
```

When executing this brick, I would get something like this:

```shell
mason make my_custom_bloc
? What is the page name? (login) auth
? What is the bloc name? (login) auth
```

which mean if I want to use the same value for both inputs (and that value differs from the default value) I have to enter it two times.

What I would like to do is something like this:

```shell
mason make my_custom_bloc
? What is the page name? (login) auth
? What is the bloc name? (auth) auth # automatically suggested by the brick, based on previous input
```

where the second input default value matches what has been entered by the user for the first input.

I would expect to write a brick definition that looks similar to this:

```yaml
name: my_custom_bloc
description: Generate a new custom Bloc in Dart
version: 0.1.0+1

environment:
mason: ">=0.1.0-dev.32 <0.1.0"

vars:
page:
type: string
description: The name of the page containing the future bloc.
default: login
prompt: What is the page name?
bloc:
type: string
description: The name of the bloc class.
# This input default could be set to what has already been entered for a previous variable
default: {{ page }}
prompt: What is the bloc name?
```

Does that make sense ?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.