Allow first positional argument to be the password selection.
parent
dfca1f44c5
commit
2aae3e9091
|
@ -2,6 +2,8 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"flag"
|
||||||
|
//"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -49,22 +51,31 @@ func call(stack []*exec.Cmd, pipes []*io.PipeWriter) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var b1 bytes.Buffer
|
var selection string
|
||||||
if err := Execute(&b1,
|
flag.Parse()
|
||||||
exec.Command("qubes-pass-client", "list", "-f"),
|
switch specified := flag.Arg(0); specified {
|
||||||
exec.Command("tail", "-n", "+2"),
|
case "":
|
||||||
exec.Command("zenity", "--list", "--title", "Select a Password", "--column", "Password"),
|
//fmt.Printf("Specified: %q\n", specified)
|
||||||
); err != nil {
|
var b1 bytes.Buffer
|
||||||
log.Fatalln(err)
|
if err := Execute(&b1,
|
||||||
}
|
exec.Command("qubes-pass-client", "list", "-f"),
|
||||||
selection := b1.String()
|
exec.Command("tail", "-n", "+2"),
|
||||||
|
exec.Command("zenity", "--list", "--width=666", "--height=999", "--title", "Select a Password", "--column", "Password"),
|
||||||
|
); err != nil {
|
||||||
|
log.Fatalln(err)
|
||||||
|
}
|
||||||
|
selection = b1.String()
|
||||||
//io.Copy(os.Stdout, &b1)
|
//io.Copy(os.Stdout, &b1)
|
||||||
|
default:
|
||||||
|
//fmt.Printf("Specified: %q\n", specified)
|
||||||
|
selection = specified
|
||||||
|
}
|
||||||
|
|
||||||
var b2 bytes.Buffer
|
var b2 bytes.Buffer
|
||||||
if err := Execute(&b2,
|
if err := Execute(&b2,
|
||||||
exec.Command("qubes-pass-client", "show", selection),
|
exec.Command("qubes-pass-client", "show", selection),
|
||||||
exec.Command("sed", "2q;d"),
|
exec.Command("sed", "2q;d"),
|
||||||
exec.Command("timeout", "--preserve-status", "9", "xclip", "-quiet", "-loops", "1"),
|
exec.Command("timeout", "--preserve-status", "12", "xclip", "-quiet", "-loops", "1"),
|
||||||
); err != nil {
|
); err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue