Is there support for making invoke.yaml context settings cli flags?

Abierto
#984 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python
Área
cli

Línea de trabajo

Start with the configuration documentation and the task parameter handling represented by @task, Context, Collection.configure, and Collection.from_module. Determine whether configured values can become task parameters or CLI flags, and define completion as either a documented supported mechanism with tests or a clear explanation of the limitation.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

CLI frameworks like Cobra work like this, your params aren't just settable as cli flags, but also in a config file.

It appears pyinvoke separates the two.

I can define cli flags on the individual funcs

@task
def show_config(ctx: Context, myflag: str, myotherflag: str):

But "configuration" is an entirely separate thing: https://docs.pyinvoke.org/en/latest/concepts/configuration.html

Is it at all possible to define flags as part of configuration like this:

ns = Collection()
col = Collection.from_module("my_module")
col.configure({"myflag": "default value", "myotherflag": "default value"})
ns.add_collection(col)

@task
def show_config(ctx: Context) # Have the decorator magically inject myflag and myotherflag from config

Is there a way I could add this myself if its not supported?

I looks like I can't expand a dict like this right?

d = dict(p1=1, p2=2)
@task
def my_cmd(ctx: Context, **d):
Lenguaje dominante
Python
Estrellas
4.8k
Forks
412
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

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

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pyinvoke/invoke

Todos los issues de pyinvoke/invoke

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.