refac!(selector): rename "-" to "STDOUT", add short opt
This commit is contained in:
parent
3454a67b4c
commit
11ad8149ad
2 changed files with 3 additions and 3 deletions
4
main.go
4
main.go
|
@ -23,11 +23,11 @@ var (
|
||||||
|
|
||||||
picker = app.Command("pick", "Pick an item from clipboard history")
|
picker = app.Command("pick", "Pick an item from clipboard history")
|
||||||
maxPicker = picker.Flag("max-items", "scrollview length").Default("15").Int()
|
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")
|
clearer = app.Command("clear", "Remove item(s) from history")
|
||||||
maxClearer = clearer.Flag("max-items", "scrollview length").Default("15").Int()
|
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()
|
clearAll = clearer.Flag("all", "Remove all items").Short('a').Default("false").Bool()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ func selector(data []string, max int, tool string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// output to stdout and return
|
// output to stdout and return
|
||||||
if tool == "-" {
|
if tool == "STDOUT" {
|
||||||
escaped, _ := preprocessData(data, false)
|
escaped, _ := preprocessData(data, false)
|
||||||
os.Stdout.WriteString(strings.Join(escaped, "\n"))
|
os.Stdout.WriteString(strings.Join(escaped, "\n"))
|
||||||
return "", nil
|
return "", nil
|
||||||
|
|
Loading…
Reference in a new issue