Skip to content

Commit

Permalink
shell/fish: add pre_exec function that records but does not execute a…
Browse files Browse the repository at this point in the history
… command
  • Loading branch information
joshi4 committed Sep 17, 2024
1 parent c6b8567 commit b306bfb
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion shell/fish.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,18 @@ end
set -g SAVVY_INPUT_FILE {{.SocketPath}}
`

var fishTemplate *template.Template
const fishRecordHistoryScript = `
function savvy_record_history_skip_execution --on-event fish_preexec
set -l cmd $argv[1]
SAVVY_SOCKET_PATH={{.SocketPath}} savvy send "$cmd"
exec fish
end
`

var (
fishTemplate *template.Template
fishRecordHistoryTemplate *template.Template
)

func init() {
fishTemplate = template.Must(template.New("fish").Parse(fishBaseScript))
Expand Down

0 comments on commit b306bfb

Please sign in to comment.