Documentation ¶
Index ¶
- type DefaultInteractor
- func (i DefaultInteractor) BuildWindowsAgsAndURL(url string) (args []string, escapedURL string)
- func (i DefaultInteractor) CopyFile(source, destination string) error
- func (i DefaultInteractor) CreateAbsoluteFolderPath(path string) error
- func (i DefaultInteractor) DoesPathExist(path string) bool
- func (i DefaultInteractor) GetCurrentExecutableLocation() string
- func (i DefaultInteractor) GetHomeDirAbsolutePath() string
- func (i DefaultInteractor) IsWSL() (bool, error)
- func (i *DefaultInteractor) OpenURL(url string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultInteractor ¶
type DefaultInteractor struct{}
DefaultInteractor is the default OS interactor that wraps go standard os package functionality to satisfy different interfaces
func (DefaultInteractor) BuildWindowsAgsAndURL ¶ added in v0.3.5
func (i DefaultInteractor) BuildWindowsAgsAndURL(url string) (args []string, escapedURL string)
BuildWindowsAgsAndURL builds the command args and escapes the url for the Windows command to open a browser. The character & is treated as running a separate command in Windows cmd /c start "http://domain.com?param1¶m2" results in trying to run cmd /c "start http://domain.com?parm1" & param2 Also, the " char is used as the delimiter to escape special characters, so "&" would become \&\ cmd /c start 'http://domain.com?param1=value with space"&"param2=value2' works when inputting directly to the command prompt, but the "&" is escaped by \"&\" when passed from code, which becomes \&\, resulting in cmd /c start 'http://domain.com?param1\&\param2' The start command uses ^ to escape special characters
func (DefaultInteractor) CopyFile ¶
func (i DefaultInteractor) CopyFile(source, destination string) error
CopyFile copies the source file to the destination file preserving permissions
func (DefaultInteractor) CreateAbsoluteFolderPath ¶
func (i DefaultInteractor) CreateAbsoluteFolderPath(path string) error
CreateAbsoluteFolderPath creates the passed in path as a directory
func (DefaultInteractor) DoesPathExist ¶
func (i DefaultInteractor) DoesPathExist(path string) bool
DoesPathExist returns a boolean as to whether the passed in path exists or not
func (DefaultInteractor) GetCurrentExecutableLocation ¶
func (i DefaultInteractor) GetCurrentExecutableLocation() string
GetCurrentExecutableLocation returns the location of the currently executing binary
func (DefaultInteractor) GetHomeDirAbsolutePath ¶
func (i DefaultInteractor) GetHomeDirAbsolutePath() string
GetHomeDirAbsolutePath returns the absolute path of the current users home directory
func (DefaultInteractor) IsWSL ¶ added in v0.3.5
func (i DefaultInteractor) IsWSL() (bool, error)
IsWSL runs the "uname -a" command to see if the output contains "microsoft" and returns true if it does, else false. This is so we can check if the Linux OS is actually Windows SubSystem for Linux, which requires A different command to open a browser.
func (*DefaultInteractor) OpenURL ¶
func (i *DefaultInteractor) OpenURL(url string) error
OpenURL opens the passed in url in the default OS browser