Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Document adding print-completion-script to venv

Đang mở
#959 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python, shell
Lĩnh vực
cli

Hướng nghiên cứu

Start by reviewing the venv activate script integration point and the existing print-completion-script entry point, using the provided Invoke task as a reference. Clarify which shells and activation paths are supported, then verify that activating a virtual environment makes completion available and that the relevant behavior is covered by tests.

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

Mô tả

We can also add the print-completion-script to the venv activate script. here an example how to do it with invoke

import os
import pathlib
import sys
import invoke

ROOT_DIR = pathlib.Path(__file__).parent


@invoke.task
def complete(context):
    """Activate the invoke shell completion."""
    shell = pathlib.Path(os.environ.get("SHELL", "")).name
    completion_script = context.run(
        f"invoke --print-completion-script {shell}",
        hide=True,
    ).stdout
    with open(".invoke-completion.sh", "w", encoding="UTF-8") as f:
        f.write(completion_script)
    venv_activate = pathlib.Path(sys.executable).parent / 'activate'
    with open(venv_activate, "a", encoding="UTF-8") as f:
        f.write(f"\n. {ROOT_DIR / '.invoke-completion.sh'}\n")

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

Chuẩn bị môi trường

Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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.