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 ArgumentOpenFiles
- 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 ArgumentOpenFiles ¶ added in v0.1.0
type ArgumentOpenFiles struct {
// contains filtered or unexported fields
}
ArgumentOpenFiles tracks expected OnOpenFile callbacks for files in a CLI request. It must only be used on the application's main goroutine.
func (*ArgumentOpenFiles) Clear ¶ added in v0.1.0
func (f *ArgumentOpenFiles) Clear()
Clear forgets any callbacks MyGo did not deliver.
func (*ArgumentOpenFiles) Consume ¶ added in v0.1.0
func (f *ArgumentOpenFiles) Consume(path string) bool
Consume skips one expected callback for path.
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.
func (Request) ArgumentOpenFiles ¶ added in v0.1.0
func (r Request) ArgumentOpenFiles(args []string, wd string, extensions []string) *ArgumentOpenFiles
ArgumentOpenFiles counts the paths MyGo v0.10.0 will redeliver from raw arguments. MyGo checks each argument on its own, even when Parse deduplicates equivalent paths or strips its --goto suffix.
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
// contains filtered or unexported fields
}
UsageError identifies an invalid command-line argument.
func (*UsageError) Error ¶
func (e *UsageError) Error() string