* [PATCH datacenter-manager 0/2] fix: cli: bash completions not working for CLI tools
@ 2026-02-06 16:35 Shan Shaji
2026-02-06 16:35 ` [PATCH datacenter-manager 1/2] fix: cli: replace completion file suffix from `.bc` to `.bash` Shan Shaji
2026-02-06 16:35 ` [PATCH datacenter-manager 2/2] fix: cli: remove completion files for service bins Shan Shaji
0 siblings, 2 replies; 3+ messages in thread
From: Shan Shaji @ 2026-02-06 16:35 UTC (permalink / raw)
To: pdm-devel
Shell completions for the CLIs were not working because the completion
files were installed with the `.bc` extension.
According to the bash-completion documentation [1], completion files should
either use the `.bash` extension or no extension at all. Debian currently ships
bash-completion 2.16 [2]. Since installing files without an extension is
planned to be deprecated in >=2.18, use the `.bash` extension for
compatibility with future versions.
documentaion quote:
> The completion filename for command foo in this directory should be foo.bash.
> Unsuffixed foo also works, but it is deprecated in >= 2.18.
Passing the `bashcomplete` argument to proxmox-datacenter-api and
proxmox-datacenter-privileged-api results in an error instead of generating
completions. Since these binaries are systemd-managed service executables
rather than user facing CLI tools, providing bash completion helpers might not
be useful. Since i was not sure why we had completions for the same
i added it as another patch. Please correct me if i have missed anything.
[1]- https://github.com/scop/bash-completion/blob/06547b33f6de3b6f8ba730f00e7f585297a31b4f/README.md?plain=1#L184
[2]- https://packages.debian.org/en/trixie/bash-completion
Testing
=======
bash-completion: v2.16
I have tested by installing the completion files with .bash extension and
without any extension. In both cases, the completion worked correctly.
Shan Shaji (2):
fix: cli: replace completion file suffix from `.bc` to `.bash`
fix: cli: remove completion files for service bins
Makefile | 4 ++--
cli/completions/Makefile | 2 +-
debian/proxmox-datacenter-manager-client.install | 2 +-
debian/proxmox-datacenter-manager.install | 8 ++------
4 files changed, 6 insertions(+), 10 deletions(-)
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH datacenter-manager 1/2] fix: cli: replace completion file suffix from `.bc` to `.bash`
2026-02-06 16:35 [PATCH datacenter-manager 0/2] fix: cli: bash completions not working for CLI tools Shan Shaji
@ 2026-02-06 16:35 ` Shan Shaji
2026-02-06 16:35 ` [PATCH datacenter-manager 2/2] fix: cli: remove completion files for service bins Shan Shaji
1 sibling, 0 replies; 3+ messages in thread
From: Shan Shaji @ 2026-02-06 16:35 UTC (permalink / raw)
To: pdm-devel
The completions were not working because of the file name extension of
the completion file. According to the `bash-completion` documentation,
completion file needs to have a `.bash` suffix or without any suffix.
documentation quote:
> The completion filename for command `foo` in this directory should be
> `foo.bash`. Unsuffixed foo also works, but it is deprecated in >= 2.18.
Since the .bash extension works on the current 2.16 bash-completion
version available in debian, replaced the `.bc` suffix with `.bash`
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
Makefile | 2 +-
cli/completions/Makefile | 2 +-
debian/proxmox-datacenter-manager-client.install | 2 +-
debian/proxmox-datacenter-manager.install | 8 ++++----
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 91fe684..b10fed7 100644
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@ COMPILED_BINS := \
$(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN) $(INTERNAL_SERVICE_BIN))
# completion helper get generated on build
-BASH_COMPLETIONS := $(addsuffix .bc,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
+BASH_COMPLETIONS := $(addsuffix .bash,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
ZSH_COMPLETIONS := $(addprefix _,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
SHELL_COMPLETION_FILES := $(addprefix $(COMPLETION_DIR)/,$(BASH_COMPLETIONS) $(ZSH_COMPLETIONS))
diff --git a/cli/completions/Makefile b/cli/completions/Makefile
index 5972355..5e7b2f7 100644
--- a/cli/completions/Makefile
+++ b/cli/completions/Makefile
@@ -2,7 +2,7 @@
all:
# bash completion
-%.bc:
+%.bash:
@echo "creating bash completion definition for $*"
@printf '# $* bash completion\n\n' >$@.tmp
@printf "complete -C '$* bashcomplete' $*\n" >>$@.tmp
diff --git a/debian/proxmox-datacenter-manager-client.install b/debian/proxmox-datacenter-manager-client.install
index 1844173..eb9d782 100644
--- a/debian/proxmox-datacenter-manager-client.install
+++ b/debian/proxmox-datacenter-manager-client.install
@@ -1,4 +1,4 @@
usr/bin/proxmox-datacenter-manager-client
-usr/share/bash-completion/completions/proxmox-datacenter-manager-client.bc
+usr/share/bash-completion/completions/proxmox-datacenter-manager-client.bash
usr/share/man/man1/proxmox-datacenter-manager-client.1
usr/share/zsh/vendor-completions/_proxmox-datacenter-manager-client
diff --git a/debian/proxmox-datacenter-manager.install b/debian/proxmox-datacenter-manager.install
index 499e07f..7942146 100644
--- a/debian/proxmox-datacenter-manager.install
+++ b/debian/proxmox-datacenter-manager.install
@@ -10,10 +10,10 @@ usr/libexec/proxmox/proxmox-datacenter-manager-daily-update
usr/libexec/proxmox/proxmox-datacenter-privileged-api
usr/sbin/pdmAtoB
usr/sbin/proxmox-datacenter-manager-admin
-usr/share/bash-completion/completions/pdmAtoB.bc
-usr/share/bash-completion/completions/proxmox-datacenter-api.bc
-usr/share/bash-completion/completions/proxmox-datacenter-manager-admin.bc
-usr/share/bash-completion/completions/proxmox-datacenter-privileged-api.bc
+usr/share/bash-completion/completions/pdmAtoB.bash
+usr/share/bash-completion/completions/proxmox-datacenter-api.bash
+usr/share/bash-completion/completions/proxmox-datacenter-manager-admin.bash
+usr/share/bash-completion/completions/proxmox-datacenter-privileged-api.bash
usr/share/man/man1/proxmox-datacenter-api.1
usr/share/man/man1/proxmox-datacenter-manager-admin.1
usr/share/man/man1/proxmox-datacenter-privileged-api.1
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH datacenter-manager 2/2] fix: cli: remove completion files for service bins
2026-02-06 16:35 [PATCH datacenter-manager 0/2] fix: cli: bash completions not working for CLI tools Shan Shaji
2026-02-06 16:35 ` [PATCH datacenter-manager 1/2] fix: cli: replace completion file suffix from `.bc` to `.bash` Shan Shaji
@ 2026-02-06 16:35 ` Shan Shaji
1 sibling, 0 replies; 3+ messages in thread
From: Shan Shaji @ 2026-02-06 16:35 UTC (permalink / raw)
To: pdm-devel
Passing the `bashcomplete` argument to proxmox-datacenter-api and
proxmox-datacenter-privileged-api results in an error instead of
generating completions.
Since these binaries are systemd-managed service executables rather
than user facing CLI tools, providing bash completion helpers is not
useful.
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
Makefile | 4 ++--
debian/proxmox-datacenter-manager.install | 4 ----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index b10fed7..940a2e7 100644
--- a/Makefile
+++ b/Makefile
@@ -53,8 +53,8 @@ COMPILED_BINS := \
$(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN) $(INTERNAL_SERVICE_BIN))
# completion helper get generated on build
-BASH_COMPLETIONS := $(addsuffix .bash,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
-ZSH_COMPLETIONS := $(addprefix _,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN))
+BASH_COMPLETIONS := $(addsuffix .bash,$(USR_BIN) $(USR_SBIN))
+ZSH_COMPLETIONS := $(addprefix _,$(USR_BIN) $(USR_SBIN))
SHELL_COMPLETION_FILES := $(addprefix $(COMPLETION_DIR)/,$(BASH_COMPLETIONS) $(ZSH_COMPLETIONS))
tests ?= --workspace
diff --git a/debian/proxmox-datacenter-manager.install b/debian/proxmox-datacenter-manager.install
index 7942146..001d727 100644
--- a/debian/proxmox-datacenter-manager.install
+++ b/debian/proxmox-datacenter-manager.install
@@ -11,15 +11,11 @@ usr/libexec/proxmox/proxmox-datacenter-privileged-api
usr/sbin/pdmAtoB
usr/sbin/proxmox-datacenter-manager-admin
usr/share/bash-completion/completions/pdmAtoB.bash
-usr/share/bash-completion/completions/proxmox-datacenter-api.bash
usr/share/bash-completion/completions/proxmox-datacenter-manager-admin.bash
-usr/share/bash-completion/completions/proxmox-datacenter-privileged-api.bash
usr/share/man/man1/proxmox-datacenter-api.1
usr/share/man/man1/proxmox-datacenter-manager-admin.1
usr/share/man/man1/proxmox-datacenter-privileged-api.1
usr/share/man/man5/remotes.cfg.5
usr/share/man/man5/views.cfg.5
usr/share/zsh/vendor-completions/_pdmAtoB
-usr/share/zsh/vendor-completions/_proxmox-datacenter-api
usr/share/zsh/vendor-completions/_proxmox-datacenter-manager-admin
-usr/share/zsh/vendor-completions/_proxmox-datacenter-privileged-api
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-06 16:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-06 16:35 [PATCH datacenter-manager 0/2] fix: cli: bash completions not working for CLI tools Shan Shaji
2026-02-06 16:35 ` [PATCH datacenter-manager 1/2] fix: cli: replace completion file suffix from `.bc` to `.bash` Shan Shaji
2026-02-06 16:35 ` [PATCH datacenter-manager 2/2] fix: cli: remove completion files for service bins Shan Shaji
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox