refac: apply staticcheck
This commit is contained in:
parent
ddfea6b831
commit
c57453be90
2 changed files with 3 additions and 5 deletions
2
main.go
2
main.go
|
@ -34,7 +34,7 @@ var (
|
||||||
clearToolArgs = clearer.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").String()
|
clearToolArgs = clearer.Flag("tool-args", "Extra arguments to pass to the --tool").Short('T').Default("").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()
|
||||||
|
|
||||||
restorer = app.Command("restore", "Serve the last recorded item from history")
|
_ = app.Command("restore", "Serve the last recorded item from history")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -43,7 +43,7 @@ func selector(data []string, max int, tool string, prompt string, toolsArgs stri
|
||||||
case "wofi":
|
case "wofi":
|
||||||
args = []string{"wofi", "-p", prompt, "--cache-file", "/dev/null", "--dmenu"}
|
args = []string{"wofi", "-p", prompt, "--cache-file", "/dev/null", "--dmenu"}
|
||||||
default:
|
default:
|
||||||
return "", fmt.Errorf("Unsupported tool: %s", tool)
|
return "", fmt.Errorf("unsupported tool: %s", tool)
|
||||||
}
|
}
|
||||||
|
|
||||||
args = append(args, strings.Fields(toolsArgs)...)
|
args = append(args, strings.Fields(toolsArgs)...)
|
||||||
|
@ -66,9 +66,7 @@ func selector(data []string, max int, tool string, prompt string, toolsArgs stri
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
selected := string(b[:len(b)-1]) // drop newline added by dmenu/rofi/wofi
|
sel, ok := guide[string(b[:len(b)-1])] // drop newline added by dmenu/roi/wofi
|
||||||
|
|
||||||
sel, ok := guide[selected]
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return "", errors.New("couldn't recover original string")
|
return "", errors.New("couldn't recover original string")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue