Documentation ¶
Overview ¶
Package util contains utility functions used by various commands.
Index ¶
- Constants
- Variables
- func BindPFlag(v *viper.Viper, key string, f *pflag.Flag)
- func CopyDir(src string, dst string) error
- func CopyDirAfero(fs afero.Fs, src string, dst string) error
- func CopyFile(src, dst string) error
- func CopyFileAfero(fs afero.Fs, src, dst string) error
- func FSCheckIfDirPathExists(path string) error
- func FSCopyDir(src string, dst string) error
- func FSCopyFile(src, dst string) error
- func GetFSPathPrompt(message string, def string) (input string, err error)
- func GetInputPrompt(message string) (input string, err error)
- func GetInputPromptWithDefault(message string, def string) (input string, err error)
- func GetSelectPrompt(message string, options []string) (selection string, err error)
- func GetServerStatus(versionEndpoint string, httpClient *httpc.Client) (err error)
- func GetYesNoPrompt(message string) (promptResp bool, err error)
- func NewTableWriter(w io.Writer) *tablewriter.Table
- func Unzip(archive, target string) error
- type GitUtil
- type PrefixWriter
- type ServerState
- type VersionFlag
Constants ¶
const ( ActionsCodegenOrg string = "hasura/codegen-assets" ActionsCodegenRepoURI string = "https://github.com/hasura/codegen-assets.git" ActionsCodegenDirName string = "actions-codegen-assets" )
Default Codegen Assets constants
const ( LEVEL_0 = iota LEVEL_1 LEVEL_2 LEVEL_3 )
const ViperEnvPrefix = "HASURA_GRAPHQL"
ViperEnvPrefix - Env prefix to be used in viper
Variables ¶
var ViperEnvReplacer = strings.NewReplacer(".", "_")
ViperEnvReplacer - Env replacer to be used in viper
Functions ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.
func CopyDirAfero ¶
CopyDir but with afero
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
func FSCheckIfDirPathExists ¶
func FSCopyFile ¶
func GetInputPrompt ¶
func GetSelectPrompt ¶
func GetServerStatus ¶
func GetYesNoPrompt ¶
func NewTableWriter ¶
func NewTableWriter(w io.Writer) *tablewriter.Table
Types ¶
type GitUtil ¶
type GitUtil struct { URI string Path string // Optional ReferenceName plumbing.ReferenceName DisableCloneOrUpdate bool Logger *logrus.Logger }
func (*GitUtil) EnsureCloned ¶
func (*GitUtil) EnsureUpdated ¶
EnsureUpdated will ensure the destination path exists and is up to date.
func (*GitUtil) IsGitCloned ¶
type PrefixWriter ¶
type PrefixWriter interface { // Write writes text with the specified indentation level. Write(level int, format string, a ...interface{}) // WriteLine writes an entire line with no indentation level. WriteLine(a ...interface{}) // Flush forces indendation to be reset. Flush() }
PrefixWriter can write text at various indentation levels.
func NewPrefixWriter ¶
func NewPrefixWriter(out io.Writer) PrefixWriter
NewPrefixWriter creates a new PrefixWriter.
type ServerState ¶
ServerState is the state of Hasura stored on the server.
func GetServerState ¶
func GetServerState(client *httpc.Client, endpoint string, hasMetadataV3 bool, log *logrus.Logger) *ServerState
GetServerState queries a server for the state.
type VersionFlag ¶
func NewVersionFlagValue ¶
func NewVersionFlagValue(p *VersionFlag) *VersionFlag
NewVersionFlagValue returns ConfigVersion set with default value
func (*VersionFlag) Set ¶
func (c *VersionFlag) Set(s string) error
Set sets the value of the named command-line flag.
func (*VersionFlag) String ¶
func (c *VersionFlag) String() string
func (*VersionFlag) Type ¶
func (c *VersionFlag) Type() string
Type returns a string that uniquely represents this flag's type.