Skip to content
Snippets Groups Projects
Select Git revision
  • 3499fcc8402747fc774cbe344c6731c040c5c51e
  • main default protected
  • dev protected
  • hotfixes-oct-2022
  • refactor/avatar-cell
  • 1.1.5
  • 1.1.4
  • 1.1.3
  • 1.1
  • 1.0.8
  • 1.0.7
  • 1.0.6
12 results

Callbacks.swift

Blame
  • 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"
    	jww "github.com/spf13/jwalterweatherman"
    	"github.com/spf13/viper"
    )
    
    // 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)
    }