Add support for cli completion in git bash for windows
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- bash
- Lĩnh vực
- cli
Hướng nghiên cứu
Start with the upstream az.completion script referenced in the issue and reproduce completion on Windows 11 using Git Bash and the Windows MSI installation. Compare its behavior with the provided tempfile-aware workaround and the related discussion in Azure CLI #26051. Done means pressing Tab after az offers Azure CLI commands instead of filesystem paths, or the Git Bash limitation and workaround are documented.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Request
Please make the Azure CLI Bash completion script honor
ARGCOMPLETE_USE_TEMPFILES by using _ARGCOMPLETE_STDOUT_FILENAME and
reading the completion results from that file. This would allow Git Bash on
Windows to use the completion script without users replacing its completion
function in their .bashrc.
Alternatively, document the Git Bash limitation and this workaround.
Reproduction
On Windows 11 with Git Bash and Azure CLI installed via the Windows MSI,
sourcing the upstream az.completion script and setting
ARGCOMPLETE_USE_TEMPFILES=1 is not sufficient: pressing Tab after az
offers filesystem paths instead of CLI commands.
The tempfile-aware function below works in this environment. I tested it with
Azure CLI 2.90.0. It creates _ARGCOMPLETE_STDOUT_FILENAME, reads the
completion results from the temporary file, and cleans it up.
Related discussion: Azure CLI #26051, which describes the Git Bash file
descriptor limitation.
Environment
- OS: Windows 11
- Shell: Git Bash (
MINGW64) - Azure CLI installation: Windows MSI
- Azure CLI version:
{
"azure-cli": "2.90.0",
"azure-cli-core": "2.90.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"azure-devops": "1.0.8"
}
}
Workaround
Using the stock bash completion file
curl -fsSL https://raw.githubusercontent.com/Azure/azure-cli/dev/az.completion -o ~/.azure/.az.completion
The completion in this scenario needs to use temp files and to get this going you need the completion to also be temp-file aware like this:
if [[ -r "$HOME/.azure/.az.completion" ]]; then
export ARGCOMPLETE_USE_TEMPFILES=1
source "$HOME/.azure/.az.completion"
_az_python_argcomplete() {
local IFS=$'\013'
local SUPPRESS_SPACE=0
local TMPFILE
local STATUS
if compopt +o nospace 2>/dev/null; then
SUPPRESS_SPACE=1
fi
TMPFILE=$(mktemp) || return 1
COMPREPLY=($(
IFS="$IFS" \
COMP_LINE="$COMP_LINE" \
COMP_POINT="$COMP_POINT" \
COMP_TYPE="$COMP_TYPE" \
_ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" \
_ARGCOMPLETE=1 \
_ARGCOMPLETE_SUPPRESS_SPACE=$SUPPRESS_SPACE \
ARGCOMPLETE_USE_TEMPFILES=1 \
_ARGCOMPLETE_STDOUT_FILENAME="$TMPFILE" \
"$1" 8>&1 9>&2 1>/dev/null 2>/dev/null
STATUS=$?
cat "$TMPFILE"
rm -f "$TMPFILE"
exit "$STATUS"
))
STATUS=$?
if [[ $STATUS != 0 ]]; then
unset COMPREPLY
elif [[ $SUPPRESS_SPACE == 1 ]] && [[ "${COMPREPLY[0]}" =~ [=/:]$ ]]; then
compopt -o nospace
fi
}
fi
- Ngôn ngữ chính
- Python
- Star
- 4.6k
- Fork
- 3.5k
- Merge trung bình
- 4 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 53
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Azure/azure-cli
-
act-observability-squad Auto-Assign ContainerApp Output Service Attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Azure/azure-cli#33149 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
act-codegen-extensibility-squad Auto-Assign Documentation MySQL Possible-Solution Service Attention Similar-Issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Azure/azure-cli#33009 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
act-codegen-extensibility-squad Auto-Assign AzureStackHCI Documentation needs-triage Service Attention
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Azure/azure-cli#32586 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`az mysql flexible-server import` command `--auto-scale-iops` option is defined two default valueĐang mởact-codegen-extensibility-squad Auto-Assign customer-reported Documentation MySQL needs-triage Service Attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Azure/azure-cli#32568 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Auto-Resolve bug customer-reported Service Attention
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Azure/azure-cli#32452 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Azure/azure-cli
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
letsencrypt/cp-cps#353 ·
-
Marble Madness II is missingĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
PedestrianDynamics/pyFDS-Evac#394 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
DOI-USGS/pywatershed#421 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
python-pillow/Pillow#10087 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày