Skip to content

Instantly share code, notes, and snippets.

@sle-c
Created April 16, 2019 04:24
Show Gist options
  • Save sle-c/7641684b86d3bc3355648b70b2c961f5 to your computer and use it in GitHub Desktop.
Save sle-c/7641684b86d3bc3355648b70b2c961f5 to your computer and use it in GitHub Desktop.
Handlers for app command to create and get app
func createApp(cmd *cobra.Command, args []string) {
appName := args[0]
keyPair := app.CreateApp(appName, db)
printResult(keyPair)
}
func getApp(cmd *cobra.Command, args []string) {
publicKey := args[0]
keyPair := app.GetApp(publicKey, db)
printResult(keyPair)
}
func printResult(keyPair *app.App) {
fmt.Println("Name: ", keyPair.Name)
fmt.Println("Public Key: ", keyPair.PublicKey)
fmt.Println("Secret Key: ", keyPair.SecretKey)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment