Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp command duration helper/plugin #1906

Merged
merged 7 commits into from
Mar 4, 2022

Commits on Mar 4, 2022

  1. Configuration menu
    Copy the full SHA
    ad1d73a View commit details
    Browse the repository at this point in the history
  2. lib/command_duration: dynamic clock hand

    Calculate the position (from 1 to 12) of the hour hand on the clock emoji used for the _command_duration string.
    
    Expressly handle COMMAND_DURATION_COLOR as blank when undefined.
    gaelicWizard committed Mar 4, 2022
    Configuration menu
    Copy the full SHA
    09e8c25 View commit details
    Browse the repository at this point in the history
  3. lib/command_duration: Refactor using $EPOCHREALTIME

    Fallback to `$SECONDS` for older versions of _Bash_.
    
    Instead of shortcircuiting the definition, just short-circuit the function. This allows the variable to be set later, e.g. on theme change.
    gaelicWizard committed Mar 4, 2022
    Configuration menu
    Copy the full SHA
    33505d4 View commit details
    Browse the repository at this point in the history
  4. plugin/cmd-returned-notify: Rewrite to match/use lib/command_duration

    Use `$EPOCHREALTIME` (or `$SECONDS`) built-in variable provided by Bash instead of `date +%s`. We're only measuing the difference in seconds, so avoid both the binary invocation as well as the subshell.
    
    Alsö, Reduce environmental pollution by not exporting every variable, and unsetting when done.
    
    Change variable names to match lib/command-duration
    
    Remove `preexec_return_notification()` in favor of `lib/command-duration`'s `_command_duration_pre_exec()`.
    
    This should now use the same preexec hook and variables as the theme library `command_duration`.
    
    tests: handle nanoseconds
    gaelicWizard committed Mar 4, 2022
    Configuration menu
    Copy the full SHA
    6ca10cf View commit details
    Browse the repository at this point in the history
  5. lib/command_duration: rename theme/command_duration.theme

    Rename the `theme/command_duration.theme` file as it's not really got anything to do with theming or SCM.
    gaelicWizard committed Mar 4, 2022
    Configuration menu
    Copy the full SHA
    4e0e592 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    1c2fc28 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    866e5be View commit details
    Browse the repository at this point in the history