(disclaimer: real user experiencing issue - ai helped investigate and write up report - user validated for accuracy)
The generated bash completion script pollutes the user's shell history with dozens of set +o/set -o commands every time tab completion is triggered. This makes the bash history nearly unusable.
ArgumentParser version: 1.7.0 (current release) and main branch
Swift version: Swift version swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)
Checklist
Steps to Reproduce
Use the FingerString CLI tool as a live example (small codebase, easy to parse):
- using bash as your shell...
- Install FingerString:
brew tap mredig/pizza-mcp-tools
brew install fingerstring
Or build from source:
git clone https://github.com/mredig/FingerString.git
cd FingerString
swift build
- Generate and source the bash completion script:
fingerstring --generate-completion-script bash > fingerstring-completion.bash
source fingerstring-completion.bash
- Trigger tab completion 3-4 times:
fingerstring list-<TAB>
fingerstring task-<TAB>
fingerstring <TAB>
- Check bash history:
Reference code: The tool uses custom completions in several commands. All tested completions cause this behavior. See examples:
Expected behavior
Tab completion should work without polluting the user's bash history. Ideally, the history should only contain actual commands the user executed, not internal shell state inspection commands from the completion script.
Actual behavior
Every tab completion trigger adds approximately 20 set +o/set -o commands to bash history:
1001 set +o ignoreeof
1002 set -o interactive-comments
1003 set +o keyword
1004 set -o monitor
1005 set +o noclobber
1006 set +o noexec
1007 set +o noglob
1008 set +o nolog
1009 set +o notify
1010 set +o nounset
1011 set +o onecmd
1012 set +o physical
1013 set +o pipefail
1014 set +o posix
1015 set +o privileged
1016 set +o verbose
1017 set +o vi
1018 set +o xtrace
1019 fingerstring list-all
1020 set +o ignoreeof
1021 set -o interactive-comments
...
This repeats every time tab completion is used, making bash history nearly unusable with dozens or hundreds of these commands accumulating.
(disclaimer: real user experiencing issue - ai helped investigate and write up report - user validated for accuracy)
The generated bash completion script pollutes the user's shell history with dozens of
set +o/set -ocommands every time tab completion is triggered. This makes the bash history nearly unusable.ArgumentParser version:
1.7.0(current release) andmainbranchSwift version: Swift version
swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)Checklist
mainbranch of this packageSteps to Reproduce
Use the FingerString CLI tool as a live example (small codebase, easy to parse):
Or build from source:
git clone https://github.com/mredig/FingerString.git cd FingerString swift buildReference code: The tool uses custom completions in several commands. All tested completions cause this behavior. See examples:
Expected behavior
Tab completion should work without polluting the user's bash history. Ideally, the history should only contain actual commands the user executed, not internal shell state inspection commands from the completion script.
Actual behavior
Every tab completion trigger adds approximately 20
set +o/set -ocommands to bash history:This repeats every time tab completion is used, making bash history nearly unusable with dozens or hundreds of these commands accumulating.