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

オープン
#984 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
cli

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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):
主要言語
Python
スター
4.8k
フォーク
412
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pyinvoke/invoke のほかの issue

pyinvoke/invoke の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。