aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_utils.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-02-12 20:20:20 +0100
committerJoe <rbo@gmx.us>2024-02-12 20:20:20 +0100
commit97dfd4023230d2351e2850a05f30a6ea3cda7273 (patch)
tree9bedf1aca638fa3721f36858de2c51285e7294e7 /src/c_utils.go
parentfine actually (diff)
downloadhardflip-97dfd4023230d2351e2850a05f30a6ea3cda7273.tar.gz
hardflip-97dfd4023230d2351e2850a05f30a6ea3cda7273.tar.bz2
hardflip-97dfd4023230d2351e2850a05f30a6ea3cda7273.tar.xz
hardflip-97dfd4023230d2351e2850a05f30a6ea3cda7273.tar.zst
hardflip-97dfd4023230d2351e2850a05f30a6ea3cda7273.zip
tmp
Diffstat (limited to 'src/c_utils.go')
-rw-r--r--src/c_utils.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/c_utils.go b/src/c_utils.go
index 3b94cc1..cfcba8e 100644
--- a/src/c_utils.go
+++ b/src/c_utils.go
@@ -52,6 +52,7 @@
package main
import (
+ "bytes"
"errors"
"fmt"
"os"
@@ -169,3 +170,33 @@ func c_decrypt_str(str string) (string, error) {
out, err := cmd.Output()
return string(out), err
}
+
+func c_get_secret_gpg_keyring(ui *HardUI) []string {
+ var keys []string
+ var out bytes.Buffer
+ cmd_fmt := []string{
+ `gpg`,
+ `--list-secret-keys`,
+ `|`,
+ `grep`,
+ `-A`,
+ `2`,
+ `'^sec'`,
+ `|`,
+ `sed`,
+ `'{/^sec/d;/--/d;s/^uid.*] //;}'`,
+ }
+
+ ui.s.Fini()
+ cmd := exec.Command(cmd_fmt[0], cmd_fmt[1:]...)
+ cmd.Stdout = &out
+ if err := cmd.Run(); err != nil {
+ c_die("failed to list gpg secret keys", err)
+ c_error_mode("failed to list gpg secret keys", err, ui)
+ return nil
+ }
+ fmt.Printf("%s\n", out.String())
+ os.Exit(0)
+ // keys[0] = string(cmd)
+ return keys
+}