config

package
v0.30.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddAccountCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "account",
		Short:   "Add account to configuration",
		Example: "flow config add account",
		Args:    cobra.NoArgs,
	},
	Flags: &addAccountFlags,
	RunS:  addAccount,
}
View Source
var AddCmd = &cobra.Command{
	Use:              "add <account|contract|deployment|network>",
	Short:            "Add resource to configuration",
	Example:          "flow config add account",
	Args:             cobra.ExactArgs(1),
	TraverseChildren: true,
}
View Source
var AddContractCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "contract",
		Short:   "Add contract to configuration",
		Example: "flow config add contract",
		Args:    cobra.NoArgs,
	},
	Flags: &addContractFlags,
	RunS:  addContract,
}
View Source
var AddDeploymentCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "deployment",
		Short:   "Add deployment to configuration",
		Example: "flow config add deployment",
		Args:    cobra.NoArgs,
	},
	Flags: &addDeploymentFlags,
	RunS:  addDeployment,
}
View Source
var AddNetworkCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "network",
		Short:   "Add network to configuration",
		Example: "flow config add network",
		Args:    cobra.NoArgs,
	},
	Flags: &addNetworkFlags,
	RunS:  addNetwork,
}
View Source
var Cmd = &cobra.Command{
	Use:              "config",
	Short:            "Utilities to manage configuration",
	TraverseChildren: true,
}
View Source
var CompletionCmd = &cobra.Command{
	Use:                   "setup-completions [powershell]",
	Short:                 "Setup command autocompletion",
	DisableFlagsInUseLine: true,
	ValidArgs:             []string{"powershell"},
	Args:                  cobra.MaximumNArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		shell := ""
		if len(args) == 1 {
			shell = args[0]
		}

		if shell == "powershell" {
			_ = cmd.Root().GenPowerShellCompletion(os.Stdout)
		} else {
			shell, shellOS := output.AutocompletionPrompt()

			if shell == "bash" && shellOS == "MacOS" {
				_ = cmd.Root().GenBashCompletionFile("/usr/local/etc/bash_completion.d/flow")

				fmt.Printf("Flow command completions installed in: /usr/local/etc/bash_completion.d/flow\n")
				fmt.Printf("You will need to start a new shell for this setup to take effect.\n\n")
			} else if shell == "bash" && shellOS == "Linux" {
				_ = cmd.Root().GenBashCompletionFile("/etc/bash_completion.d/flow")

				fmt.Printf("Flow command completions installed in: /etc/bash_completion.d/flow\n")
				fmt.Printf("You will need to start a new shell for this setup to take effect.\n\n")
			} else if shell == "zsh" {
				c := exec.Command("zsh", "-c ", `echo -n ${fpath[1]}`)
				path, _ := c.Output()
				_ = cmd.Root().GenZshCompletionFile(fmt.Sprintf("%s/_flow", path))

				fmt.Printf("Flow command completions installed in: '%s/_flow'\n", path)
				fmt.Printf("You will need to start a new shell for this setup to take effect.\n\n")
			}
		}
	},
}
View Source
var InitCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:   "init",
		Short: "Initialize a new configuration",
	},
	Flags: &InitFlag,
	Run:   Initialise,
}
View Source
var InitFlag = FlagsInit{}
View Source
var RemoveAccountCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "account <name>",
		Short:   "Remove account from configuration",
		Example: "flow config remove account Foo",
		Args:    cobra.MaximumNArgs(1),
	},
	Flags: &removeAccountFlags,
	RunS:  removeAccount,
}
View Source
var RemoveCmd = &cobra.Command{
	Use:              "remove <account|contract|deployment|network>",
	Short:            "Remove resource from configuration",
	Example:          "flow config remove account",
	Args:             cobra.ExactArgs(1),
	TraverseChildren: true,
}
View Source
var RemoveContractCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "contract <name>",
		Short:   "Remove contract from configuration",
		Example: "flow config remove contract Foo",
		Args:    cobra.MaximumNArgs(1),
	},
	Flags: &removeContractFlags,
	RunS:  removeContract,
}
View Source
var RemoveDeploymentCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "deployment <account> <network>",
		Short:   "Remove deployment from configuration",
		Example: "flow config remove deployment Foo testnet",
		Args:    cobra.MaximumNArgs(2),
	},
	Flags: &removeDeploymentFlags,
	RunS:  removeDeployment,
}
View Source
var RemoveNetworkCommand = &command.Command{
	Cmd: &cobra.Command{
		Use:     "network <name>",
		Short:   "Remove network from configuration",
		Example: "flow config remove network Foo",
		Args:    cobra.MaximumNArgs(1),
	},
	Flags: &removeNetworkFlags,
	RunS:  removeNetwork,
}

Functions

func Initialise added in v0.24.0

func Initialise(
	_ []string,
	readerWriter flowkit.ReaderWriter,
	_ command.GlobalFlags,
	services *services.Services,
) (command.Result, error)

Types

type FlagsInit

type FlagsInit struct {
	ServicePrivateKey  string `flag:"service-private-key" info:"Service account private key"`
	ServiceKeySigAlgo  string `default:"ECDSA_P256" flag:"service-sig-algo" info:"Service account key signature algorithm"`
	ServiceKeyHashAlgo string `default:"SHA3_256" flag:"service-hash-algo" info:"Service account key hash algorithm"`
	Reset              bool   `default:"false" flag:"reset" info:"Reset configuration file"`
	Global             bool   `default:"false" flag:"global" info:"Initialize global user configuration"`
}

type InitResult

type InitResult struct {
	*flowkit.State
}

func (*InitResult) JSON

func (r *InitResult) JSON() interface{}

func (*InitResult) Oneliner

func (r *InitResult) Oneliner() string

func (*InitResult) String

func (r *InitResult) String() string

type Result added in v0.24.0

type Result struct {
	// contains filtered or unexported fields
}

func (*Result) JSON added in v0.24.0

func (r *Result) JSON() interface{}

func (*Result) Oneliner added in v0.24.0

func (r *Result) Oneliner() string

func (*Result) String added in v0.24.0

func (r *Result) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL