diff options
| author | Jeff Carr <[email protected]> | 2025-09-18 07:30:04 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-18 07:30:04 -0500 |
| commit | fec80aca170e85e9bb8c122ae2c6c2283930f252 (patch) | |
| tree | 39591ce1b2b561544a31a31ba9688a386ada69cd | |
| parent | 1522a2fef0ed356f12a5c9cc011cdad6b4cd4a05 (diff) | |
rename files
| -rw-r--r-- | bash.Completion.go (renamed from bashCompletion.go) | 0 | ||||
| -rw-r--r-- | bash.new.go (renamed from bash2.go) | 5 | ||||
| -rw-r--r-- | bash.orig.go (renamed from bash.go) | 0 | ||||
| -rw-r--r-- | smartcd.test | 18 |
4 files changed, 23 insertions, 0 deletions
diff --git a/bashCompletion.go b/bash.Completion.go index e0eb965..e0eb965 100644 --- a/bashCompletion.go +++ b/bash.Completion.go @@ -218,6 +218,7 @@ func parseArgv(argname string) *Auto { func Bash2(argname string, autocomplete func(*Auto)) { newauto := parseArgv(argname) if newauto.SetupAuto { + // --bash was passed. try to configure bash-completion doBash2(argname) os.Exit(0) } @@ -230,6 +231,10 @@ func Bash2(argname string, autocomplete func(*Auto)) { if len(os.Args) > 1 && os.Args[1] == "--auto-complete" { doHandlePB(newauto) autocomplete(newauto) + if newauto.Debug { + // check here to see if there was any completion text sent + // if not, send "reset bash newline\n" to cause bash to redraw PS1 for the user + } os.Exit(0) } diff --git a/smartcd.test b/smartcd.test new file mode 100644 index 0000000..b67a5ea --- /dev/null +++ b/smartcd.test @@ -0,0 +1,18 @@ +_cd_complete() +{ + # sets local to this func vars + local cur prev all + cur=${COMP_WORDS[COMP_CWORD]} + # prev=${COMP_WORDS[COMP_CWORD-1]} + all=${COMP_WORDS[@]} + + # this is where we generate the go-arg output + GOARGS=$(smartcd --auto-complete \'$cur\' $all) + + # this compares the command line input from the user + # to whatever strings we output + COMPREPLY=( $(compgen -W "$GOARGS" -- $cur) ) # THIS WORKS + return 0 +} +complete -F _cd_complete cd + |
