Bash-it / bash-it

A community Bash framework.
MIT License
14.14k stars 2.29k forks source link

Fix clock_hand to display correct hour hand #2240

Open BarbUk opened 5 months ago

BarbUk commented 5 months ago

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

Checklist: