2
0
mirror of https://github.com/junegunn/fzf synced 2024-11-10 13:10:44 +00:00
fzf/main.go

56 lines
1.1 KiB
Go
Raw Normal View History

2015-01-01 19:49:30 +00:00
package main
import (
_ "embed"
"fmt"
"strings"
2021-11-03 15:59:04 +00:00
fzf "github.com/junegunn/fzf/src"
"github.com/junegunn/fzf/src/protector"
)
2015-01-01 19:49:30 +00:00
2024-04-14 15:02:27 +00:00
var version string = "0.50"
var revision string = "devel"
2017-06-02 08:57:28 +00:00
//go:embed shell/key-bindings.bash
var bashKeyBindings []byte
//go:embed shell/completion.bash
var bashCompletion []byte
//go:embed shell/key-bindings.zsh
var zshKeyBindings []byte
//go:embed shell/completion.zsh
var zshCompletion []byte
//go:embed shell/key-bindings.fish
var fishKeyBindings []byte
func printScript(label string, content []byte) {
fmt.Println("### " + label + " ###")
fmt.Println(strings.TrimSpace(string(content)))
fmt.Println("### end: " + label + " ###")
}
2015-01-01 19:49:30 +00:00
func main() {
protector.Protect()
options := fzf.ParseOptions()
if options.Bash {
printScript("key-bindings.bash", bashKeyBindings)
printScript("completion.bash", bashCompletion)
return
}
if options.Zsh {
printScript("key-bindings.zsh", zshKeyBindings)
printScript("completion.zsh", zshCompletion)
return
}
if options.Fish {
printScript("key-bindings.fish", fishKeyBindings)
fmt.Println("fzf_key_bindings")
return
}
fzf.Run(options, version, revision)
2015-01-01 19:49:30 +00:00
}