From f22027a201eb85ebe2448c3301dbaed467dcad4b Mon Sep 17 00:00:00 2001 From: Mike Brown Date: Fri, 5 May 2023 14:16:30 -0400 Subject: [PATCH] Write autocomplete script at 'bashgpt config' time --- cmd/bashgpt/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/bashgpt/main.go b/cmd/bashgpt/main.go index 0836afa..36bfbf8 100644 --- a/cmd/bashgpt/main.go +++ b/cmd/bashgpt/main.go @@ -70,6 +70,11 @@ func configMain(args []string) error { return fmt.Errorf("Could not write OpenAI API key file %v: %w", keyPath, err) } + err = checkLatestAutocompleteScript() + if err != nil { + return fmt.Errorf("Could not write autocomplete script: %w", keyPath, err) + } + fmt.Printf("Add the following to your .bashrc or equivalent:\n if [ -f ~/.config/%v/%v ]; then\n . ~/.config/%v/%v\n fi\n", CommandName, AutocompleteScript, CommandName, AutocompleteScript)