utils

package
v0.0.0-...-e345738 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDirExist

func EnsureDirExist(filePath string) error

EnsureDirExist create directory specified by filePath

func IsDirEmpty

func IsDirEmpty(path string) bool

IsDirEmpty return true if directory is empty

func IsDirLink(path string) (bool, error)

IsDirLink return true if path is a directory and symbol link

func IsDirectory

func IsDirectory(path string) (bool, error)

IsDirectory return true if path is directory

func IsFileExist

func IsFileExist(path string) bool

IsFileExist return true if file exist

func IsLink(path string) (bool, error)

IsLink return true if path is a symbol link

Types

type Command

type Command interface {
	// Short returns string about short description of the command
	// the string is shown in help screen of cobra command
	Short() string

	// Setup is used to setup flags or pre-run steps for the command.
	//
	// For example,
	//  cmd.Flags().IntVarP(&r.num, "num", "n", 5, "description")
	//
	Setup(cmd *cobra.Command)

	// Run runs the command runner
	// run returns command runner which is a function with dependency
	// injected arguments.
	//
	// For example,
	//  Command{
	//   Run: func(l lib.Logger) {
	// 	   l.Info("i am working")
	// 	 },
	//  }
	//
	Run() CommandRunner
}

Command interface is used to implement sub-commands in the system.

type CommandRunner

type CommandRunner interface{}

Directories

Path Synopsis
Package errors provides simple error handling primitives.
Package errors provides simple error handling primitives.

Jump to

Keyboard shortcuts

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