Skip to content

Instantly share code, notes, and snippets.

@vhbui02
Created April 29, 2023 05:04
Show Gist options
  • Save vhbui02/a013b01e507df71b3ccc7ada5a05af05 to your computer and use it in GitHub Desktop.
Save vhbui02/a013b01e507df71b3ccc7ada5a05af05 to your computer and use it in GitHub Desktop.
[status command] query fish runtime information #fish

Some option that needs to be remembered

status: no arguments, simply display the current login and job control status of the Fish shell.

status is-login / --is-login / -l: return 0 if current Fish shell is a login shell

status is-interactive / --is-interactive / -i: return 0 if current Fish shell is interactive (connected to a keyboard)

status is-block / --is-block / -b: return 0 if fish is currently executing a block of code.

status is-command-substitution: return 0 if fish is currently executing a command substiturion.

status current-command: prints the name of the currently-running function or command (similar to $_ bash variable) (usually fish)

status current-commandline: prints the entirety of the currently-running commandline (jobs and operators are included) (usually nothing)

E.g.

status filename / current-filename / --current-filename / -f: prints the filename of the currently-running script (layer of execution is considered here!)

  • If the current script was called via a symlink, this will return the symlink.
  • If the current script was received by piping into source, this will return - (usually the function that aren't created interactively but using 'alias' (which use source internally) or function & funcsave).

status basename: prints just the filename of the running script, without any path components before.

status dirname: prints just the path to the running script, without the actual filename. (usually .)

status fish-path: prints the absolute path to the currently executing instace of Fish (usually /usr/bin/fish)

status function / current-function: prints the name of the currently called function (if able), when you're not inside a function, displays Not a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment