Skip to main content

Module cli_path

Module cli_path 

Source
Expand description

The app’s command line on PATH.

Windows puts the package’s current directory on the user Path from the install hook and takes it off from the uninstall hook. macOS links /usr/local/bin/<command> to the binary in the .app, with administrator rights asked through osascript; Linux links ~/.local/bin/<command> to the AppImage. Both are made and removed when the user asks. An update keeps the binary’s path, so nothing is made again after one.

Structs§

CliSpec
The command line a package puts on PATH.

Enums§

CliStatus
Whether the command line is on PATH.

Constants§

LOGIN_PATH_WAIT
How long on_login_path waits for the shell: an interactive shell’s start files can take several seconds on a machine busy with its disk.

Functions§

install
Puts the command line on PATH. Never replaces another program’s: a file that is not a link, or a link to another file (CliStatus::Taken).
on_login_path
Whether dir is on the PATH a terminal gets: the one the user’s login shell sets up, or None when the shell does not answer within LOGIN_PATH_WAIT. A window started from the desktop’s menu often has a shorter PATH than a terminal, since shells add ~/.local/bin in their own start files, so on_path would warn about a directory every terminal has; and a busy machine can take seconds to start a shell, so a missing answer is not a “no”. It blocks while the shell starts: call it off the UI thread.
on_path
Whether dir is on this process’s PATH: Linux’s ~/.local/bin is not on every distribution’s.
status
Whether the command line is on PATH.
uninstall
Takes the command line off PATH. Nothing to take off is not an error.