Documentation
¶
Index ¶
- func ContainsInt(needle int, haystack []int) bool
- func GetLocalSSHKeys(keysDirectory string) ([]string, map[string]string, error)
- func GetNKeyValuePairsStringMap(kvd map[string]string) int
- func GitClone(cloneURL, localPath string) error
- func GitInit(cloneURL, localPath string) error
- func HTTPGet(targetURL url.URL, headers map[string]string) (*http.Response, error)
- func IsPathType(pathInfo os.FileInfo, pathType PathType) bool
- func OpenURIWithDefaultApplication(targetURI string) error
- func PathExists(asType PathType, pathFragments ...string) (bool, error)
- func ResolvePath(relativePathFragments ...string) (string, error)
- func Untar(options UntarOptions) []error
- func Unzip(options UnzipOptions) []error
- type PathType
- type UntarEvent
- type UntarOptions
- type UntarState
- type UntarStatus
- type UnzipEvent
- type UnzipOptions
- type UnzipState
- type UnzipStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsInt ¶
func GetLocalSSHKeys ¶ added in v0.0.13
func GetNKeyValuePairsStringMap ¶ added in v0.0.18
GetNKeyValuePairsStringMap returns the number of key-value mappings stored in the provided `kvd` (key-value dictionary)
func GitClone ¶ added in v0.1.9
GitClone does a `git clone` on the provided :cloneURL into the directory at :localPath. If the remote is a bare repository, a new repository will be initialised at :localPath with the `origin` remote set to :cloneURL
func OpenURIWithDefaultApplication ¶
OpenURIWithDefaultApplication runs xdg-open on linux, open on macos, and rundll32.exe on windows with the provided :targetURI as an argument
func PathExists ¶ added in v0.0.16
func ResolvePath ¶ added in v0.0.14
func Untar ¶
func Untar(options UntarOptions) []error
Untar takes the .zip file located at options.InputPath and untars its contents to options.OutputPath; returns an error if something unexpected happened, or nil if all is well
Made possible with guidance from: https://medium.com/@skdomino/taring-untaring-files-in-go-6b07cf56bc07
func Unzip ¶
func Unzip(options UnzipOptions) []error
Unzip takes the .zip file located at options.InputPath and unzips its contents to options.OutputPath; returns an error if something unexpected happened, or nil if all is well
Made possible with guidance from: https://golangcode.com/unzip-files-in-go/
Types ¶
type UntarEvent ¶
type UntarEvent struct {
// State is a string code that indicates the underlying operation
State UntarState
// Path is a string indicating path to a file if it's non-empty
Path string
// Message is an arbitrary string
Message string
// Status should provide metadata on the underlying operation
Status *UntarStatus
}
UntarEvent is an object that is passed to the events stream for the consumer to know what's going on inside
type UntarOptions ¶
type UntarOptions struct {
// Events, if populated, receives events for logging purposes
Events chan UntarEvent
// InputPath defines the path to the .zip file we want to untar
InputPath string
// OutputPath defines the path to a directory where the untarred files
// should go
OutputPath string
// ReturnOnFileError indicates whether to return an error instantly
// when an error is encountered
ReturnOnFileError bool
}
type UntarState ¶
type UntarState string
const ( UntarStateStarting UntarState = "untar_starting" UntarStateProcessing UntarState = "untar_processing" UntarStateError UntarState = "untar_error" UntarStateOK UntarState = "untar_ok" UntarStateStatus UntarState = "untar_status" UntarStateSuccess UntarState = "untar_success" UntarStateFailed UntarState = "untar_failed" )
type UntarStatus ¶
type UntarStatus struct {
// BytesTotal is the total number of bytes to extract
BytesTotal int64
// BytesProcessed is the number of bytes processed so far
BytesProcessed int64
// FilesTotalCount is the total number of files to extract
FilesTotalCount int
// FilesProcessedCount is the number of files processed so far
FilesProcessedCount int
}
UntarStatus stores the status of the untarring process and is returned through the UntarEvent object
func (UntarStatus) GetPercentDoneByBytes ¶
func (us UntarStatus) GetPercentDoneByBytes() float64
func (UntarStatus) GetPercentDoneByFiles ¶
func (us UntarStatus) GetPercentDoneByFiles() float64
type UnzipEvent ¶
type UnzipEvent struct {
// State is a string code that indicates the underlying operation
State UnzipState
// Path is a string indicating path to a file if it's non-empty
Path string
// Message is an arbitrary string
Message string
// Status should provide metadata on the underlying operation
Status *UnzipStatus
}
UnzipEvent is an object that is passed to the events stream for the consumer to know what's going on inside
type UnzipOptions ¶
type UnzipOptions struct {
// Events, if populated, receives events for logging purposes
Events chan UnzipEvent
// InputPath defines the path to the .zip file we want to unzip
InputPath string
// OutputPath defines the path to a directory where the unzipped files
// should go
OutputPath string
// ReturnOnFileError indicates whether to return an error instantly
// when an error is encountered
ReturnOnFileError bool
}
type UnzipState ¶
type UnzipState string
const ( UnzipStateStarting UnzipState = "unzip_starting" UnzipStateProcessing UnzipState = "unzip_processing" UnzipStateError UnzipState = "unzip_error" UnzipStateOK UnzipState = "unzip_ok" UnzipStateStatus UnzipState = "unzip_status" UnzipStateSuccess UnzipState = "unzip_success" UnzipStateFailed UnzipState = "unzip_failed" )
type UnzipStatus ¶
type UnzipStatus struct {
// BytesTotal is the total number of bytes to extract
BytesTotal int64
// BytesProcessed is the number of bytes processed so far
BytesProcessed int64
// FilesTotalCount is the total number of files to extract
FilesTotalCount int
// FilesProcessedCount is the number of files processed so far
FilesProcessedCount int
}
UnzipStatus stores the status of the unzipping process and is returned through the UnzipEvent object
func (UnzipStatus) GetPercentDoneByBytes ¶
func (us UnzipStatus) GetPercentDoneByBytes() float64
func (UnzipStatus) GetPercentDoneByFiles ¶
func (us UnzipStatus) GetPercentDoneByFiles() float64