From 280ba234c862cd56f800d510b84fff37a4cc9443 Mon Sep 17 00:00:00 2001 From: stephen mcquay Date: Sun, 25 Feb 2018 01:23:38 -0800 Subject: [PATCH] Adds env subcommand --- cmd/pm/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/pm/main.go b/cmd/pm/main.go index 7f4c438..459be17 100644 --- a/cmd/pm/main.go +++ b/cmd/pm/main.go @@ -8,6 +8,7 @@ import ( const usage = `pm: simple, cross-platform system package manager subcommands: + environ (env) -- print environment information keyring (key) -- interact with pm's OpenPGP keyring ` @@ -23,7 +24,14 @@ func main() { } cmd := os.Args[1] + root := os.Getenv("PM_ROOT") + if root == "" { + root = "/usr/local" + } + switch cmd { + case "env", "environ": + fmt.Printf("PM_ROOT=%q\n", root) case "key", "keyring": if len(os.Args[1:]) < 2 { fatalf("pm keyring: insufficient args\n\nusage: %v", keyUsage)