aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorMichael Muré <michael.mure@consensys.net>2018-11-21 18:56:12 +0100
committerMichael Muré <batolettre@gmail.com>2019-03-01 22:35:36 +0100
commitfeab9412dffe5772048aad29893c4cb01d566387 (patch)
treeb7bc9751f2ebdf8d41f5621bbf372eaf7625c4b9 /commands
parent0aefae6fcca5786f2c898029c3d6282f760f2c63 (diff)
downloadgit-bug-feab9412dffe5772048aad29893c4cb01d566387.tar.gz
WIP identity in git
Diffstat (limited to 'commands')
-rw-r--r--commands/id.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/commands/id.go b/commands/id.go
new file mode 100644
index 00000000..485c5457
--- /dev/null
+++ b/commands/id.go
@@ -0,0 +1,35 @@
+package commands
+
+import (
+ "fmt"
+
+ "github.com/MichaelMure/git-bug/identity"
+ "github.com/spf13/cobra"
+)
+
+func runId(cmd *cobra.Command, args []string) error {
+ id, err := identity.GetIdentity(repo)
+ if err != nil {
+ return err
+ }
+
+ fmt.Printf("Id: %s\n", id.Id())
+ fmt.Printf("Identity: %s\n", id.DisplayName())
+ fmt.Printf("Name: %s\n", id.Name())
+ fmt.Printf("Login: %s\n", id.Login())
+ fmt.Printf("Email: %s\n", id.Email())
+ fmt.Printf("Protected: %v\n", id.IsProtected())
+
+ return nil
+}
+
+var idCmd = &cobra.Command{
+ Use: "id",
+ Short: "Display or change the user identity",
+ PreRunE: loadRepo,
+ RunE: runId,
+}
+
+func init() {
+ RootCmd.AddCommand(idCmd)
+}