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

Đang mở
#984 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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):
Ngôn ngữ chính
Python
Star
4.8k
Fork
412
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pyinvoke/invoke

Tất cả issue của pyinvoke/invoke

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.