/
init.go
39 lines (31 loc) · 1.13 KB
/
init.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package cmd
import (
"fmt"
"github.com/TosinShada/stellar-core/clients/horizonclient"
demo "github.com/TosinShada/stellar-core/txnbuild/cmd/demo/operations"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
// initCmd represents the init command
var initCmd = &cobra.Command{
Use: "init",
Short: "Create and fund some demo accounts on the TestNet",
Long: `This command creates four test accounts for use with further operations.`,
Run: func(cmd *cobra.Command, args []string) {
log.Info("Initialising TestNet accounts...")
keys := demo.InitKeys(4)
client := horizonclient.DefaultTestNetClient
demo.Initialise(client, keys)
fmt.Println("Initialisation complete.")
},
}
func init() {
rootCmd.AddCommand(initCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// initCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// initCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}