Skip to content

Commit

Permalink
Improve the --help output so that the configured Ollama model is incl.
Browse files Browse the repository at this point in the history
  • Loading branch information
xyproto committed Dec 27, 2024
1 parent 0746629 commit 4f482bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions v2/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Overview of hotkeys ctrl-l and then /
Launch tutorial ctrl-l and then ?
Disable this overview ctrl-l and then !`

ollamaHelpText = "Ollama"

usageText = `Hotkeys
ctrl-s to save
Expand Down Expand Up @@ -85,7 +87,7 @@ Flags:
-g, --digraphs List all possible digraphs.
-i, --input-file FILENAME Used as stdin when running programs with ctrl-space.
The default filename is input.txt. Handy for Advent of Code.
-o, --ollama Use Ollama and the ` + codeCompletionModel + ` model
-o, --ollama Use $OLLAMA$
for tab completion (experimental feature).
-b, --bat List the given file using bat, if it exists in the PATH.
This can be useful in connection with -c or -p.
Expand All @@ -100,7 +102,7 @@ See the man page for more information.
// Usage prints the text that appears when the --help flag is passed
func Usage() {
fmt.Println(versionString + " - simple and limited text editor")
fmt.Print(usageText)
fmt.Print(strings.Replace(usageText, "$OLLAMA$", ollamaHelpText, 1))
}

// DrawNanoHelp will draw a help box for nano hotkeys in the center
Expand Down
6 changes: 5 additions & 1 deletion v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ func main() {
return
}

if ollamaTabCompletion {
if ollamaTabCompletion || helpFlag {
codeCompletionModel = usermodel.GetCodeModel()
if codeCompletionModel != "" {
// Used by the --help output, ollamaText is "Use Ollama" before this
ollamaHelpText += " and the " + strings.TrimSuffix(codeCompletionModel, ":latest") + " model"
}
}

if helpFlag {
Expand Down

0 comments on commit 4f482bf

Please sign in to comment.