Documentation ¶
Overview ¶
Package utils - additional supplementary functions.
Index ¶
- func CliArgumentsList(osArgs []string) (arguments []string, options []string)
- func CliSubArgumentsList(osArgs []string) (arguments []string, options []string)
- func DirZipArchive(paths []string) ([]byte, error)
- func InList(source []string, value string) bool
- func PrintTable(titles []string, lines [][]string)
- func ZipAttachDir(w *zip.Writer, currentPath string) error
- func ZipAttachFile(w *zip.Writer, zipFileName, fullPath string) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CliArgumentsList ¶
CliArgumentsList - return clean list of arguments and options
Example ¶
args, options := CliArgumentsList( []string{"cfy-go", "status", "-user", "admin"}) fmt.Printf("Args: %v, Options: %v.", args, options)
Output: Args: [cfy-go status], Options: [-user admin].
func CliSubArgumentsList ¶
CliSubArgumentsList - return clean list of arguments and options
Example ¶
args, options := CliSubArgumentsList([]string{ "-data", "container-place/data", "-work-dir", "container-place/", "--", "cfy", "profile", "use", "local"}) fmt.Printf("Args: %v, Options: %v.", args, options)
Output: Args: [-data container-place/data -work-dir container-place/], Options: [cfy profile use local].
func DirZipArchive ¶
DirZipArchive - create archive from directory and return as bytes array
func InList ¶
InList - return true if string is already in list
Example ¶
if !InList([]string{"a", "b"}, "c") { fmt.Print("'c' not in ['a', 'b'] list.") }
Output: 'c' not in ['a', 'b'] list.
func PrintTable ¶
PrintTable - print table with column titles and several lines
Example ¶
PrintTable([]string{"1", "2", "3"}, [][]string{{"a", "-b", "c"}, {"d", "e", "-f-"}})
Output: +---+----+-----+ | 1 | 2 | 3 | +---+----+-----+ | a | -b | c | | d | e | -f- | +---+----+-----+
func ZipAttachDir ¶
ZipAttachDir - attach directory to zip archive
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.