commands

package
v0.0.0-...-0907076 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 61 Imported by: 1

Documentation

Overview

Package commands contains the definition for all the commands present in Hasura CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteVersions

func DeleteVersions(ec *cli.ExecutionContext, versions []uint64, source cli.Source) error

func Execute

func Execute() error

Execute executes the command and returns the error

func ExecuteMigration

func ExecuteMigration(cmd string, t *migrate.Migrate, stepOrVersion int64) error

ExecuteMigration runs the actual migration

func HandlePluginCommand

func HandlePluginCommand(pluginHandler PluginHandler, cmdArgs []string) error

HandlePluginCommand receives a pluginHandler and command-line arguments and attempts to find a plugin executable on the PATH that satisfies the given arguments.

func NewActionsCmd

func NewActionsCmd(ec *cli.ExecutionContext) *cobra.Command

NewActionsCmd returns the actions command

func NewCompletionCmd

func NewCompletionCmd(ec *cli.ExecutionContext) *cobra.Command

NewCompletionCmd return the completion command.

func NewConsoleCmd

func NewConsoleCmd(ec *cli.ExecutionContext) *cobra.Command

NewConsoleCmd returns the console command

func NewDefaultHasuraCommand

func NewDefaultHasuraCommand() *cobra.Command

NewDefaultHasuraCommand creates the `hasura` command with default arguments

func NewDefaultHasuraCommandWithArgs

func NewDefaultHasuraCommandWithArgs(pluginHandler PluginHandler, args []string, in io.Reader, out, errout io.Writer) *cobra.Command

NewDefaultHasuraCommandWithArgs creates the `hasura` command with arguments

func NewDocsCmd

func NewDocsCmd(ec *cli.ExecutionContext) *cobra.Command

NewDocsCmd returns the docs command

func NewHelpCmd

func NewHelpCmd(ec *cli.ExecutionContext) *cobra.Command

NewHelpCmd returns the help command

func NewInitCmd

func NewInitCmd(ec *cli.ExecutionContext) *cobra.Command

NewInitCmd is the definition for init command

func NewMetadataCmd

func NewMetadataCmd(ec *cli.ExecutionContext) *cobra.Command

NewMetadataCmd returns the metadata command

func NewMigrateCmd

func NewMigrateCmd(ec *cli.ExecutionContext) *cobra.Command

NewMigrateCmd returns the migrate command

func NewPluginsCmd

func NewPluginsCmd(ec *cli.ExecutionContext) *cobra.Command

NewPluginsCmd returns the plugins command

func NewScriptsCmd

func NewScriptsCmd(ec *cli.ExecutionContext) *cobra.Command

NewScriptsCmd returns the scripts command

func NewSeedCmd

func NewSeedCmd(ec *cli.ExecutionContext) *cobra.Command

NewSeedCmd will return the seed command

func NewUpdateCLICmd

func NewUpdateCLICmd(ec *cli.ExecutionContext) *cobra.Command

NewUpdateCLICmd returns the update-cli command.

func NewVersionCmd

func NewVersionCmd(ec *cli.ExecutionContext) *cobra.Command

NewVersionCmd returns the version command

Types

type ConsoleOptions

type ConsoleOptions struct {
	EC *cli.ExecutionContext

	APIPort     string
	ConsolePort string
	Address     string

	DontOpenBrowser bool

	WG *sync.WaitGroup

	StaticDir       string
	Browser         string
	UseServerAssets bool

	APIServerInterruptSignal     chan os.Signal
	ConsoleServerInterruptSignal chan os.Signal
}

func (*ConsoleOptions) Run

func (o *ConsoleOptions) Run() error

type DefaultPluginHandler

type DefaultPluginHandler struct {
	ValidPrefixes []string
}

DefaultPluginHandler implements PluginHandler

func NewDefaultPluginHandler

func NewDefaultPluginHandler(validPrefixes []string) *DefaultPluginHandler

NewDefaultPluginHandler instantiates the DefaultPluginHandler with a list of given filename prefixes used to identify valid plugin filenames.

func (*DefaultPluginHandler) Execute

func (h *DefaultPluginHandler) Execute(executablePath string, cmdArgs, environment []string) error

Execute implements PluginHandler

func (*DefaultPluginHandler) Lookup

func (h *DefaultPluginHandler) Lookup(filename string) (string, bool)

Lookup implements PluginHandler

type InitOptions

type InitOptions struct {
	EC *cli.ExecutionContext

	Version     cli.ConfigVersion
	Endpoint    string
	AdminSecret string
	InitDir     string

	Template string
}

func (*InitOptions) Run

func (o *InitOptions) Run() error

type MetadataApplyOptions

type MetadataApplyOptions struct {
	EC *cli.ExecutionContext

	FromFile bool
	DryRun   bool
	// contains filtered or unexported fields
}

func (*MetadataApplyOptions) Run

func (o *MetadataApplyOptions) Run() error

type MetadataClearOptions

type MetadataClearOptions struct {
	EC *cli.ExecutionContext
}

func (*MetadataClearOptions) Run

func (o *MetadataClearOptions) Run() error

type MetadataDiffOptions

type MetadataDiffOptions struct {
	EC     *cli.ExecutionContext
	Output io.Writer
	Args   []string

	// two Metadata to diff, 2nd is server if it's empty
	Metadata [2]string
}

func (*MetadataDiffOptions) Run

func (o *MetadataDiffOptions) Run() error

type MetadataExportOptions

type MetadataExportOptions struct {
	EC *cli.ExecutionContext
	// contains filtered or unexported fields
}

func (*MetadataExportOptions) Run

func (o *MetadataExportOptions) Run() error

type MigrateApplyOptions

type MigrateApplyOptions struct {
	EC *cli.ExecutionContext

	UpMigration      string
	DownMigration    string
	VersionMigration string
	MigrationType    string
	// version up to which migration chain has to be applied
	GotoVersion   string
	SkipExecution bool

	Source cli.Source
	// contains filtered or unexported fields
}

func (*MigrateApplyOptions) Run

func (o *MigrateApplyOptions) Run() error

type MigrateDeleteOptions

type MigrateDeleteOptions struct {
	EC *cli.ExecutionContext

	Source cli.Source
	// contains filtered or unexported fields
}

func (*MigrateDeleteOptions) Run

func (o *MigrateDeleteOptions) Run() error

type MigrateStatusOptions

type MigrateStatusOptions struct {
	EC     *cli.ExecutionContext
	Source cli.Source
}

func (*MigrateStatusOptions) Run

type PluginHandler

type PluginHandler interface {
	// exists at the given filename, or a boolean false.
	// Lookup will iterate over a list of given prefixes
	// in order to recognize valid plugin filenames.
	// The first filepath to match a prefix is returned.
	Lookup(filename string) (string, bool)
	// Execute receives an executable's filepath, a slice
	// of arguments, and a slice of environment variables
	// to relay to the executable.
	Execute(executablePath string, cmdArgs, environment []string) error
}

PluginHandler is capable of parsing command line arguments and performing executable filename lookups to search for valid plugin files, and execute found plugins. courtesy: kubectl https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/cmd.go

type PluginInstallOptions

type PluginInstallOptions struct {
	EC *cli.ExecutionContext

	Name         string
	ManifestFile string
	Version      util.VersionFlag
}

func (*PluginInstallOptions) Run

func (o *PluginInstallOptions) Run() error

type PluginUpgradeOptions

type PluginUpgradeOptions struct {
	EC *cli.ExecutionContext

	Name    string
	Version util.VersionFlag
}

func (*PluginUpgradeOptions) Run

type SeedApplyOptions

type SeedApplyOptions struct {
	EC     *cli.ExecutionContext
	Driver *seed.Driver

	// seed file to apply
	FileNames []string
	Source    cli.Source
}

func (*SeedApplyOptions) Run

func (o *SeedApplyOptions) Run() error

type SeedNewOptions

type SeedNewOptions struct {
	EC     *cli.ExecutionContext
	Driver *seed.Driver

	// filename for the new seed file
	SeedName string
	// table name if seed file has to be created from a database table
	FromTableNames []string

	// seed file that was created
	FilePath string
	Source   cli.Source
}

func (*SeedNewOptions) Run

func (o *SeedNewOptions) Run() error

Jump to

Keyboard shortcuts

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