cmd

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cmd provides utilities for parsing and handling command line arguments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MemProfile

func MemProfile()

MemProfile creates a memory profile if requested by environment variable.

func NextArg

func NextArg(i *int, args []string) string

NextArg retrieves the next argument from the commandline.

func ReadInput

func ReadInput(filenameIsCode bool, filename *string) (input string, err error)

ReadInput gets Jsonnet code from the given place (file, commandline, stdin). It also updates the given filename to <stdin> or <cmdline> if it wasn't a real filename.

func SafeReadInput

func SafeReadInput(filenameIsCode bool, filename *string) string

SafeReadInput runs ReadInput, exiting the process if there was a problem.

func SafeStrToInt

func SafeStrToInt(str string) (i int)

SafeStrToInt returns the int or exits the process.

func SimplifyArgs

func SimplifyArgs(args []string) (r []string)

SimplifyArgs transforms an array of commandline arguments so that any -abc arg before the first -- (if any) are expanded into -a -b -c.

func StartCPUProfile

func StartCPUProfile()

StartCPUProfile creates a CPU profile if requested by environment variable.

func StopCPUProfile

func StopCPUProfile()

StopCPUProfile ensures any running CPU profile is stopped.

func WriteOutputFile

func WriteOutputFile(output string, outputFile string, createDirs bool) (err error)

WriteOutputFile writes the output to the given file, creating directories if requested, and printing to stdout instead if the outputFile is "".

Types

This section is empty.

Jump to

Keyboard shortcuts

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