bash-it icon indicating copy to clipboard operation
bash-it copied to clipboard

Fix clock_hand to display correct hour hand

Open BarbUk opened this issue 4 months ago • 0 comments

Description

When using the lib to display the command duration, the dynamic clock is off by 1.

Motivation and Context

This change is required to have a dynamic clock that output the correct clock hand.

How Has This Been Tested?

Before:

for second in {1..15}; do     
  clock_hand=$(printf '%x' $(((${1:-${second}} % 12) + 144)))
  printf '%b' "\xf0\x9f\x95\x$clock_hand"
done

🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕐🕑🕒🕓

After:

for second in {1..15}; do     
  clock_hand=$(printf '%x' $((((${1:-${second}} -1 ) % 12) + 144)))
  printf '%b' "\xf0\x9f\x95\x$clock_hand"
done

🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕐🕑🕒

Types of changes

  • [X] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [X] My code follows the code style of this project.
  • [X] If my change requires a change to the documentation, I have updated the documentation accordingly.
  • [X] I have read the CONTRIBUTING document.
  • [X] If I have added a new file, I also added it to clean_files.txt and formatted it using lint_clean_files.sh.
  • [ ] I have added tests to cover my changes, and all the new and existing tests pass.

BarbUk avatar Feb 08 '24 12:02 BarbUk