Something went wrong on our end
init.go 1.39 KiB
///////////////////////////////////////////////////////////////////////////////
// Copyright © 2020 xx network SEZC //
// //
// Use of this source code is governed by a license that can be found in the //
// LICENSE file //
///////////////////////////////////////////////////////////////////////////////
// Package cmd initializes the CLI and config parsers as well as the logger.
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/spf13/viper"
jww "github.com/spf13/jwalterweatherman"
)
// initCmd creates a new user object with the given NDF
var initCmd = &cobra.Command{
Use: "init",
Short: ("Initialize a user ID but do not connect to the network"),
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
client := createClient()
user := client.GetUser()
jww.INFO.Printf("User: %s", user.ReceptionID)
writeContact(user.GetContact())
fmt.Printf("%s\n", user.ReceptionID)
},
}
func init() {
initCmd.Flags().StringP("userid-prefix", "", "",
"Desired prefix of userID to brute force when running init command. Prepend (?i) for case-insensitive. Only Base64 characters are valid.")
_ = viper.BindPFlag("userid-prefix", initCmd.Flags().Lookup("userid-prefix"))
rootCmd.AddCommand(initCmd)
}