goharbor / goharbor/harbor-cli
[bug]: Bash completion tainted with uncommented comment text
- Dominant language
- Go
- Stars
- 163
- Forks
- 211
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
## Description
Installed `harbor-cli` using Homebrew on macOS, which adds its Bash completion script under `/usr/local/etc/bash_completion.d`:
```bash
$ ls -l /usr/local/etc/bash_completion.d/harbor
lrwxr-xr-x 1 erhhung 59 2026-07-14 16:03 /usr/local/etc/bash_completion.d/harbor -> ../../Cellar/harbor-cli/0.0.24/etc/bash_completion.d/harbor
```
When this script is automatically sourced in all terminal shells, they output:
```
bash: command not found: Data
bash: command not found: Config
```
Due to the uncommented "comment text" added to the beginning of the completion script:
```bash
Data file created at /private/tmp/harbor-cli-20260707-4955-xvrpom/harbor-cli-0.0.24/.brew_home/.local/share/harbor-cli/data.yaml with configPath: /private/tmp/harbor-cli-20260707-4955-xvrpom/harbor-cli-0.0.24/.brew_home/.config/harbor-cli/config.yaml
Config file created at /private/tmp/harbor-cli-20260707-4955-xvrpom/harbor-cli-0.0.24/.brew_home/.config/harbor-cli/config.yaml# bash completion V2 for harbor -*- shell-script -*-
__harbor_debug()
{
if [[ -n ${BASH_COMP_DEBUG_FILE-} ]]; then
echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
fi
}
# Macs have bash3 for which the bash-completion package doesn't include
# _init_completion. This is a minimal version of that function.
__harbor_init_completion()
{
COMPREPLY=()
_get_comp_words_by_ref "$@" cur prev words cword
}
...
```
## Steps to Reproduce
1. `brew install harbor-cli`
2. Make sure `.bash_profile` sources files under `/usr/local/etc/bash_completion.d`
3. Open a Bash terminal tab
## Expected Behavior
Shell completion scripts load cleanly.
## Actual Behavior
Shell executes non-shell commands.
## Environment
- OS: macOS 15.7.7
```bash
$ harbor version
Version: 0.0.24
Go version: 1.26.4
Git commit: Homebrew
Built: 2026-07-07T13:46:05Z
OS/Arch: darwin/amd64
```
Contributor guide
Research direction
Start by inspecting the installed `/usr/local/etc/bash_completion.d/harbor` script and the `brew install harbor-cli` output path described in the report. Reproduce the issue by sourcing the completion directory in Bash, then trace where the `Data file created` and `Config file created` lines enter the script; done means completion loads without executing those lines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100