GithubHelp home page GithubHelp logo

dniemeijer / fish-command-timer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jichu4n/fish-command-timer

0.0 0.0 0.0 22 KB

Fish shell extension for printing execution time for each command.

License: Apache License 2.0

Shell 100.00%

fish-command-timer's Introduction

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 measured time.
  • set fish_command_timer_color blue: The color of the output. This should be a color string recognized by fish's set_color command, as described here. If not set, the output will be in the default color.
  • 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.

Setting fish_command_timer_enabled to 0 and fish_command_timer_export_cmd_duration_str to 1 allows printing the time in the subsequent prompt without also having it printed after the command completes.

fish-command-timer's People

Contributors

danielb2 avatar djebbz avatar edwinhoksberg avatar jichu4n avatar noamnelke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.