added env variable

This commit is contained in:
ston1th 2023-03-21 01:18:48 +01:00
commit 1d5d900f26
2 changed files with 20 additions and 7 deletions

View file

@ -43,11 +43,8 @@ func Run(arg string) {
if err != nil {
exit(err)
}
switch k.Type {
case core.Plain:
fmt.Println("Key ID:", k.ID)
case core.Shamir:
fmt.Println("Key ID:", k.ID)
fmt.Println("Key ID:", k.ID)
if k.Type == core.Shamir {
fmt.Println("Key Share:", k.Key)
}
case "del":
@ -94,11 +91,11 @@ func Run(arg string) {
if err != nil {
exit(err)
}
key.Key = out
if json {
key.Key = out
jsonOutput(key) // does not return
}
fmt.Println(key.Key)
fmt.Println(out)
case "ls":
json := outputFlags()
c := client()
@ -164,6 +161,9 @@ func getFlags() (id, share string, json bool, err error) {
if id == "" {
err = errors.New("missing flag: id")
}
if share == "" {
share = os.Getenv("KEYCTL_SHARE")
}
return
}