parse name/email
This commit is contained in:
parent
280ba234c8
commit
ea383b7a34
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
@ -39,7 +40,28 @@ func main() {
|
|||||||
sub := os.Args[2]
|
sub := os.Args[2]
|
||||||
switch sub {
|
switch sub {
|
||||||
case "c", "create":
|
case "c", "create":
|
||||||
fmt.Printf("creating keyring ...\n")
|
var name, email string
|
||||||
|
s := bufio.NewScanner(os.Stdin)
|
||||||
|
|
||||||
|
fmt.Printf("name: ")
|
||||||
|
s.Scan()
|
||||||
|
if err := s.Err(); err != nil {
|
||||||
|
fatalf("reading name: %v\n", err)
|
||||||
|
}
|
||||||
|
name = s.Text()
|
||||||
|
|
||||||
|
fmt.Printf("email: ")
|
||||||
|
s.Scan()
|
||||||
|
if err := s.Err(); err != nil {
|
||||||
|
fatalf("reading email: %v\n", err)
|
||||||
|
}
|
||||||
|
email = s.Text()
|
||||||
|
|
||||||
|
if err := os.Stdin.Close(); err != nil {
|
||||||
|
fatalf("%v\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("name: %q, email: %q\n", name, email)
|
||||||
fatalf("NYI\n")
|
fatalf("NYI\n")
|
||||||
default:
|
default:
|
||||||
fatalf("unknown keyring subcommand: %q\n\nusage: %v", sub, keyUsage)
|
fatalf("unknown keyring subcommand: %q\n\nusage: %v", sub, keyUsage)
|
||||||
|
Loading…
Reference in New Issue
Block a user