All Projects → jichu4n → fish-command-timer

jichu4n / fish-command-timer

Licence: Apache-2.0 License
Fish shell extension for printing execution time for each command.

Programming Languages

shell
77523 projects

Labels

Projects that are alternatives of or similar to fish-command-timer

theme-qing
A theme for Oh My Fish.
Stars: ✭ 14 (-85.57%)
Mutual labels:  fish
hoard
cli command organizer written in rust
Stars: ✭ 71 (-26.8%)
Mutual labels:  fish
fish-exa
🐟 exa aliases for fish
Stars: ✭ 24 (-75.26%)
Mutual labels:  fish
xxh-shell-fish
Use the fish shell wherever you go through the SSH without installation on the host.
Stars: ✭ 12 (-87.63%)
Mutual labels:  fish
carapace-bin
multi-shell multi-command argument completer
Stars: ✭ 42 (-56.7%)
Mutual labels:  fish
dotpr0n
Dotfiles for macOS, FreeBSD, fish, tmux, custom functions and lots more. Peekaboo!
Stars: ✭ 44 (-54.64%)
Mutual labels:  fish
oh-my-fish
The Fish Shell Framework
Stars: ✭ 8,403 (+8562.89%)
Mutual labels:  fish
tii
Command not found? Install it right there!
Stars: ✭ 27 (-72.16%)
Mutual labels:  fish
rfishbase
R interface to the fishbase.org database
Stars: ✭ 79 (-18.56%)
Mutual labels:  fish
dotfiles
💻 My personal dotfiles for macOS using Kitty, Fish, Neovim, Tmux 🛠
Stars: ✭ 54 (-44.33%)
Mutual labels:  fish
config
Fig's integrations with bash, zsh, fish, ssh, and tmux. Also contains Fig's installation and update scripts. Finally, this repo is the root of the .fig folder that is installed on your computer when you download Fig!
Stars: ✭ 44 (-54.64%)
Mutual labels:  fish
dotfiles
Dotfiles for my personal UNIX-based machines
Stars: ✭ 16 (-83.51%)
Mutual labels:  fish
dotfiles
The best dotfiles ever to be dot-filed
Stars: ✭ 17 (-82.47%)
Mutual labels:  fish
PenTerm
Terminal config for pentesters.
Stars: ✭ 20 (-79.38%)
Mutual labels:  fish
fish logo
🐠 Fish shell colorful ASCII-art logo
Stars: ✭ 82 (-15.46%)
Mutual labels:  fish
sashimi
minimalist fish prompt made with raw fish
Stars: ✭ 53 (-45.36%)
Mutual labels:  fish
arch-xmonad-setup
My configs
Stars: ✭ 14 (-85.57%)
Mutual labels:  fish
fish
🧛🏻‍♂️ Dark theme for fish
Stars: ✭ 44 (-54.64%)
Mutual labels:  fish
dotfiles
Personal dotfiles 💻
Stars: ✭ 13 (-86.6%)
Mutual labels:  fish
.files
Dotfiles for my Mac
Stars: ✭ 24 (-75.26%)
Mutual labels:  fish

fish-command-timer

fish shell extension for printing timing information for each command line executed.

Usage

After the execution of each command line, the script prints out the total execution time (up to millisecond precision), followed by the current time. The execution time is formatted to be human readable; e.g., 2h 7m 42s301.

Demo:

Demo Screen-cap

Additionally, the script will export the total execution time (as a human readable string, e.g., 42s027) as $CMD_DURATION_STR. You can use this variable in your subsequent prompt.

Requirements

This script requires fish shell 2.2 or above. It should run pretty much out of the box on modern Linux and Mac OS X systems. Please report any incompatibilities on on GitHub.

Installation

To set up this extension, you can

  1. Download conf.d/fish_command_timer.fish and put it in ~/.config/fish/conf.d/ as per Fish shell convention.
  2. If the above doesn't work for you (perhaps because your custom settings overrides the extension), you could try sourcing it directly. Download conf.d/fish_command_timer.fish and put it in ~/.config/fish/, then add the following in your ~/.config/fish/config.fish at the end:
    source ~/.config/fish/fish_command_timer.fish
    

That's it :)

Settings

You can use the following options to tweak the behavior of the script. Put them in your config.fish. You can also modify them on-the-fly if you want the changes to only affect your current shell session.

  • set fish_command_timer_enabled: Setting this variable to 0 disables printing of all timing and exit status information.
  • set fish_command_timer_status_enabled: Setting this variable to 0 disables printing of exit status information.
  • set fish_command_timer_color blue: The color to use for timing information. This should be a color string recognized by fish's set_color command, as described here. If not set, the timing information will be in the default color.
  • set fish_command_timer_success_color green: The color of the last command's exit status if it was successful (i.e. 0).
  • set fish_command_timer_fail_color red: The color of the last command's exit status if it was not successful.
  • set fish_command_timer_time_format '%b %d %I:%M%p': The display format of the current time. This is a strftime format string (see http://strftime.org/). If empty, the current time will not be printed.
  • set fish_command_timer_millis: Whether to print timings to millisecond precision. If set to 0, will print timings up to seconds.
  • set fish_command_timer_export_cmd_duration_str: If set to 1, will export the total command execution time string to $CMD_DURATION_STR, for use in prompts. If set to 0, the $CMD_DURATION_STR variable will not be exported.
  • set fish_command_timer_min_cmd_duration: The minimum command duration (in milliseconds) that should trigger printing of command timing information. Commands that complete within the specified number of milliseconds will not trigger printing of command timing information.
    • Note that when fish_command_timer_status_enabled is set, commands that exit with a non-zero status will always trigger printing of command timing and exit status information even if they complete within $fish_command_timer_min_cmd_duration.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].