Environment
-
KFP version:
N/A (CLI usage, not a deployed Kubeflow Pipelines cluster)
-
KFP SDK version:
main branch (local install from https://github.com/kubeflow/pipelines)
-
All dependencies version:
pip list | grep kfp
Steps to reproduce
- Install shell completion for bash:
kfp --install-completion bash
2.Run the same command again:
kfp --install-completion bash
3.Open the shell configuration file:
cat ~/.bashrc
Observe that the shell completion initialization line has been appended
multiple times.
*Expected result
The CLI should check whether the shell completion initialization line already
exists in the target shell configuration file before appending it.
Running kfp --install-completion <shell> multiple times should not result in
duplicate entries in the shell configuration file.
*Materials and Reference
Source code:
sdk/python/kfp/cli/cli.py
*Relevant function:
_install_completion(shell: str)
*Current behavior:
The completion statement is appended unconditionally using file append mode,
which leads to duplicate shell completion entries.