func parseWalletFlags() {
	if cliFlags != nil {
		return
	}
	cliFlags = flag.NewFlagSet("", flag.ContinueOnError)
	cliFlags.StringVar(&FactomClient.WalletdServer, "w", "localhost:8089", "")
	cliFlags.StringVar(&FactomClient.Walletd.User, "walletuser", "", "")
	cliFlags.StringVar(&FactomClient.Walletd.Password, "walletpassword", "", "")
	stdout, stderr := os.Stdout, os.Stderr
	devNull, err := os.Open(os.DevNull)
	if err != nil {
		os.Exit(5)
	}
	os.Stdout, os.Stderr = devNull, devNull
	cliFlags.Parse(strings.Fields(os.Getenv("COMP_LINE"))[1:])
	os.Stdout, os.Stderr = stdout, stderr
	FactomClient.Walletd.Timeout = time.Second / 2
}
Parse any previously specified factom-cli options required for connecting to
factom-walletd
package flag
import (
	"context"
	"flag"
	"os"
	"strings"
	"time"
	"github.com/posener/complete"
)
func predictAddress(fa bool, num int, flagName, suffix string) complete.PredictFunc {
	if len(flagName) == 0 {
		return func(a complete.Args) []string {
			argc := len(a.Completed[1:])
			for _, arg := range a.Completed[1:] {
				if string(arg[0]) == "-" {
					argc--
				}
			}
			if len(suffix) > 0 && len(a.Last) > 0 &&
				a.Last[len(a.Last)-1:len(a.Last)] == suffix {
				return nil
			}
			if argc < num {
				adrs := listAddresses(fa)
				if len(suffix) > 0 {
					for i := range adrs {
						adrs[i] += suffix
					}
				}
				return adrs
			}
			return nil
		}
	}
	return func(a complete.Args) []string {
		argc := 0
		for i := len(a.Completed) - 1; i > 0; i-- {
			arg := a.Completed[i]
			if string(arg) == flagName {
				break
			}
			argc++
		}
		if len(suffix) > 0 && len(a.Last) > 0 &&
			a.Last[len(a.Last)-1:len(a.Last)] == suffix {
			return nil
		}
		if argc < num {
			adrs := listAddresses(fa)
			if len(suffix) > 0 {
				for i := range adrs {
					adrs[i] += suffix
				}
			}
			return adrs
		}
		return nil
	}
}
func listAddresses(fa bool) []string {
	parseWalletFlags()
	fss, ess, err := FactomClient.GetPrivateAddresses(context.Background())
	if err != nil {
		os.Exit(6)
	}
	var adrStrs []string
	if fa {
		adrStrs = make([]string, len(fss))
		for i, fs := range fss {
			adrStrs[i] = fs.FAAddress().String()
		}
	} else {
		adrStrs = make([]string, len(ess))
		for i, es := range ess {
			adrStrs[i] = es.ECAddress().String()
		}
	}
	return adrStrs
}
var cliFlags *flag.FlagSet