From d083660e8502edede9339d4cdfd14b814008c099 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 26 Jun 2025 00:33:52 +0300 Subject: fix readme --- README.md | 61 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index ce30d1b..825fa2f 100644 --- a/README.md +++ b/README.md @@ -38,40 +38,39 @@ sudo mv timr /usr/local/bin/ Add this to your fish config: - ```fish - function timr_prompt -d "Display timr timr_status in the prompt" - if command -v timr >/dev/null - set -l timr_status (timr prompt) - if test -n "$timr_status" - set -l icon (string sub -l 1 -- "$timr_status") - set -l time (string sub -s 2 -- "$timr_status") - if test "$icon" = "▶" - set_color green - else - set_color yellow - end - printf '%s' "$icon" - set_color normal - printf ' %s' "$time" +```fish +function timr_prompt -d "Display timr timr_status in the prompt" + if command -v timr >/dev/null + set -l timr_status (timr prompt) + if test -n "$timr_status" + set -l icon (string sub -l 1 -- "$timr_status") + set -l time (string sub -s 2 -- "$timr_status") + if test "$icon" = "▶" + set_color green + else + set_color yellow end + printf '%s' "$icon" + set_color normal + printf ' %s' "$time" end end - - complete -c timr -n __fish_use_subcommand -a start -d "Start the timer" - complete -c timr -n __fish_use_subcommand -a stop -d "Stop the timer" - complete -c timr -n __fish_use_subcommand -a pause -d "Pause the timer" - complete -c timr -n __fish_use_subcommand -a status -d "Show the timer status" - complete -c timr -n __fish_use_subcommand -a reset -d "Reset the timer" - complete -c timr -n __fish_use_subcommand -a live -d "Show the live timer" - complete -c timr -n __fish_use_subcommand -a prompt -d "Show the prompt status" - ``` - +end + +complete -c timr -n __fish_use_subcommand -a start -d "Start the timer" +complete -c timr -n __fish_use_subcommand -a stop -d "Stop the timer" +complete -c timr -n __fish_use_subcommand -a pause -d "Pause the timer" +complete -c timr -n __fish_use_subcommand -a status -d "Show the timer status" +complete -c timr -n __fish_use_subcommand -a reset -d "Reset the timer" +complete -c timr -n __fish_use_subcommand -a live -d "Show the live timer" +complete -c timr -n __fish_use_subcommand -a prompt -d "Show the prompt status" +``` 2. Update your `fish_prompt` or `fish_right_prompt` function to include the `timr_prompt` function: - ```fish - function fish_prompt - # ... your existing prompt ... - printf ' %s' (timr_prompt) - end - ``` +```fish +function fish_prompt + # ... your existing prompt ... + printf ' %s' (timr_prompt) +end +``` -- cgit v1.2.3