Created
May 10, 2019 13:09
-
-
Save kyriediculous/38b34c9ff3cefdcde9f14f2e4b29845d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var readCmd = &cobra.Command{ | |
Use: "read", | |
Short: "Find a Blog post by its ID", | |
Long: `Find a blog post by it's mongoDB Unique identifier. | |
If no blog post is found for the ID it will return a 'Not Found' error`, | |
RunE: func(cmd *cobra.Command, args []string) error { | |
id, err := cmd.Flags().GetString("id") | |
if err != nil { | |
return err | |
} | |
req := &blogpb.ReadBlogReq{ | |
Id: id, | |
} | |
res, err := client.ReadBlog(context.Background(), req) | |
if err != nil { | |
return err | |
} | |
fmt.Println(res) | |
return nil | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment