Documentation
¶
Index ¶
- Constants
- Variables
- func Detach(exe string, args []string) error
- func Executable() (string, error)
- func InstallShellCommand(ctx context.Context, link, exe string, elev Elevator) error
- func ShouldDetach(getenv func(string) string, dev bool) bool
- func UninstallShellCommand(ctx context.Context, link, exe string, elev Elevator) error
- func Usage(name string) string
- type Elevator
- type OSAScriptElevator
- type Request
- type Status
- type Target
- type UsageError
Constants ¶
const ShellCommandPath = "/usr/local/bin/huncrow"
ShellCommandPath is the installation path for the macOS shell command.
Variables ¶
var ( ErrHelp = errors.New("help requested") ErrVersion = errors.New("version requested") )
var ( ErrConflict = errors.New("cli: shell command path is already in use") ErrNotOurs = errors.New("cli: shell command does not point to this executable") ErrNotInstalled = errors.New("cli: application is not installed in a stable location") ErrCanceled = errors.New("cli: administrator authorization was canceled") )
Functions ¶
func Executable ¶
Executable returns the absolute, symlink-resolved application executable. Launches from App Translocation or a mounted volume return ErrNotInstalled.
func InstallShellCommand ¶
InstallShellCommand makes link a symlink to exe, replacing a symlink to anywhere else; any other entry at link returns ErrConflict. It requests administrator privileges through elev only when the direct attempt encounters a permission error.
func ShouldDetach ¶
ShouldDetach reports whether the application was launched from a terminal.
func UninstallShellCommand ¶
UninstallShellCommand removes only a symlink to exe. An absent command or a conflicting filesystem entry returns ErrNotOurs.
Types ¶
type OSAScriptElevator ¶
type OSAScriptElevator struct{}
OSAScriptElevator requests administrator authorization on macOS.
type Request ¶
type Request struct {
Folders []string
Files []Target
ReuseWindow bool
NewWindow bool
Missing []string
}
Request contains the paths and window preferences for a CLI invocation.
type Status ¶
Status describes the installed shell command. Its zero value means the path is absent. Target is the raw destination of a conflicting symlink and is empty when a different kind of entry occupies the path.
func ShellCommandStatus ¶
ShellCommandStatus inspects link without changing the filesystem.
type UsageError ¶
type UsageError struct{ Arg string }
UsageError identifies an invalid command-line argument.
func (*UsageError) Error ¶
func (e *UsageError) Error() string