From aabe2c82a54f04e060a7018c86b518045178ec56 Mon Sep 17 00:00:00 2001 From: bashbunni <15822994+bashbunni@users.noreply.github.com> Date: Thu, 7 Jul 2022 11:01:23 -0700 Subject: [PATCH] feat: output data dir with charm where (#153) * feat: output data dir with charm where * add newline after path --- cmd/where.go | 22 ++++++++++++++++++++++ main.go | 1 + 2 files changed, 23 insertions(+) create mode 100644 cmd/where.go diff --git a/cmd/where.go b/cmd/where.go new file mode 100644 index 00000000..ecda6199 --- /dev/null +++ b/cmd/where.go @@ -0,0 +1,22 @@ +package cmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var WhereCmd = &cobra.Command{ + Use: "where", + Short: "Find where your cloud.charm.sh folder resides on your machine", + Long: paragraph("Find the absolute path to your charm keys, databases, etc."), + RunE: func(cmd *cobra.Command, args []string) error { + cc := initCharmClient() + path, err := cc.DataPath() + if err != nil { + return err + } + fmt.Fprintln(cmd.OutOrStdout(), path) + return nil + }, +} diff --git a/main.go b/main.go index a1821707..34141bc4 100644 --- a/main.go +++ b/main.go @@ -101,6 +101,7 @@ func init() { cmd.FSCmd, cmd.CryptCmd, cmd.MigrateAccountCmd, + cmd.WhereCmd, manCmd, ) }