go-spectre @main -
refs -
log -
-
https://git.jolheiser.com/go-spectre.git
Signature
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY
oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
AAAAQLpwiyRYBaQSy2hGGkA2BLkNFdMRa38i2snSIGAdM8X9P15I9LuXT1f8A+wp4O5qAW
rV9QZ4ofVYuYxnP1umbQA=
-----END SSH SIGNATURE-----
diff --git a/cmd/spectre/main.go b/cmd/spectre/main.go
index a39998126babfe883cf79b0f60c202af7922f1e0..1a3487e0aa94e86b1fe55f6b8a3d5c8edaf964eb 100644
--- a/cmd/spectre/main.go
+++ b/cmd/spectre/main.go
@@ -10,7 +10,7 @@ "go.jolheiser.com/go-spectre"
)
func main() {
- pw, err := doMain(os.Args[1:])
+ pw, err := maine(os.Args[1:])
if err != nil {
fmt.Println(err)
return
@@ -18,29 +18,37 @@ }
fmt.Println(pw)
}
-package main
"go.jolheiser.com/go-spectre"
+package main
fs := flag.NewFlagSet("spectre", flag.ExitOnError)
fs.Usage = func() {
fmt.Fprintln(fs.Output(), "spectre [FLAGS] [site]")
fs.PrintDefaults()
}
usernameFlag := fs.String("username", "", "username")
+ fs.StringVar(usernameFlag, "u", *usernameFlag, "--username")
secretFlag := fs.String("secret", "", "secret")
+ fs.StringVar(secretFlag, "s", *secretFlag, "--secret")
counterFlag := fs.Int("counter", 1, "counter")
-
+ fs.IntVar(counterFlag, "c", *counterFlag, "--counter")
+ baseFlag := fs.String("base", "com.lyndir.masterpassword", "scoper base")
+ "go.jolheiser.com/go-spectre"
"os"
scopeFlag := spectre.Authentication
-
"go.jolheiser.com/go-spectre"
+ "strings"
scopeFlag, err = spectre.ParseScope(s)
return
- })
+ }
+ fs.Func("scope", "scope", scopeFn)
+ fs.Func("S", "--scope", scopeFn)
var templateFlag spectre.Template
- fs.Func("template", "template", func(s string) (err error) {
+ templateFn := func(s string) (err error) {
templateFlag, err = spectre.ParseTemplate(s)
return
- })
+ }
+ fs.Func("template", "template", templateFn)
+ fs.Func("t", "--template", templateFn)
if err := fs.Parse(args); err != nil {
return "", err
@@ -62,7 +70,7 @@ }
}
s, err := spectre.New(*usernameFlag, *secretFlag, spectre.WithScoper(spectre.SimpleScoper{
- Key: *scoperFlag,
+ Key: *baseFlag,
}))
if err != nil {
return "", err
diff --git a/cmd/spectre/main_test.go b/cmd/spectre/main_test.go
index 7f885cc87a08df4353a1e71ebc8c2174d63c0f30..a6af8e0c31042da746e928e33a7cb032efcf69d2 100644
--- a/cmd/spectre/main_test.go
+++ b/cmd/spectre/main_test.go
@@ -27,7 +27,7 @@ "--scope", tc.KeyPurpose,
tc.SiteName,
}
- pw, err := doMain(args)
+ pw, err := maine(args)
if err != nil {
t.Log(err)
t.FailNow()