refac!(selector): rename "-" to "STDOUT", add short opt

This commit is contained in:
yory8 2019-09-17 12:53:35 +02:00
parent 3454a67b4c
commit 11ad8149ad
2 changed files with 3 additions and 3 deletions

View file

@ -23,11 +23,11 @@ var (
picker = app.Command("pick", "Pick an item from clipboard history")
maxPicker = picker.Flag("max-items", "scrollview length").Default("15").Int()
pickTool = picker.Flag("tool", "Which selector to use: dmenu/rofi/-").Default("dmenu").String()
pickTool = picker.Flag("tool", "Which selector to use: dmenu/rofi/STDOUT").Short('t').Default("dmenu").String()
clearer = app.Command("clear", "Remove item(s) from history")
maxClearer = clearer.Flag("max-items", "scrollview length").Default("15").Int()
clearTool = clearer.Flag("tool", "Which selector to use: dmenu/rofi/-").Default("dmenu").String()
clearTool = clearer.Flag("tool", "Which selector to use: dmenu/rofi/STDOUT").Short('t').Default("dmenu").String()
clearAll = clearer.Flag("all", "Remove all items").Short('a').Default("false").Bool()
)

View file

@ -15,7 +15,7 @@ func selector(data []string, max int, tool string) (string, error) {
}
// output to stdout and return
if tool == "-" {
if tool == "STDOUT" {
escaped, _ := preprocessData(data, false)
os.Stdout.WriteString(strings.Join(escaped, "\n"))
return "", nil