~soywod/pimalaya

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
4 2

[PATCH] Add seconds to print-out

Details
Message ID
<20230622165528.108958-1-me@djha.skin>
DKIM signature
pass
Download raw message
Patch: +2 -1
From: Daniel Jay Haskin <daniel.haskin@angel.com>

---
 src/client/handlers.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/client/handlers.rs b/src/client/handlers.rs
index de81afd..55ffac9 100644
--- a/src/client/handlers.rs
+++ b/src/client/handlers.rs
@@ -16,7 +16,8 @@ pub fn get(client: &dyn Client) -> Result<()> {
        TimerState::Running if timer.cycle.duration < 60 => {
            println!("[{cycle}] {}s", timer.cycle.duration)
        }
        TimerState::Running => println!("[{cycle}] {}min", timer.cycle.duration / 60),
        TimerState::Running => println!("[{cycle}] {}min {}s", timer.cycle.duration / 60,
                                        timer.cycle.duration % 60),
    };

    Ok(())
-- 
2.34.1
Details
Message ID
<87ilbfyy80.fsf@posteo.net>
In-Reply-To
<20230622165528.108958-1-me@djha.skin> (view parent)
DKIM signature
pass
Download raw message
> From: Daniel Jay Haskin <daniel.haskin@angel.com>
> 
> ---
>  src/client/handlers.rs | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/client/handlers.rs b/src/client/handlers.rs
> index de81afd..55ffac9 100644
> --- a/src/client/handlers.rs
> +++ b/src/client/handlers.rs
> @@ -16,7 +16,8 @@ pub fn get(client: &dyn Client) -> Result<()> {
>          TimerState::Running if timer.cycle.duration < 60 => {
>              println!("[{cycle}] {}s", timer.cycle.duration)
>          }
> -        TimerState::Running => println!("[{cycle}] {}min", timer.cycle.duration / 60),
> +        TimerState::Running => println!("[{cycle}] {}min {}s", timer.cycle.duration / 60,
> +                                        timer.cycle.duration % 60),
>      };
>  
>      Ok(())
> -- 
> 2.34.1

Thank you for the patch. I initially did not show the seconds not to
"pollute" too much the timer, but it is my personal opinion. Instead it
could be great to add an option to customize the output, what do you
think?
Details
Message ID
<3e8f00b0-a3b7-3b03-6a1d-4419bfad12d7@djha.skin>
In-Reply-To
<87ilbfyy80.fsf@posteo.net> (view parent)
DKIM signature
pass
Download raw message
> Thank you for the patch. I initially did not show the seconds not to
> "pollute" too much the timer, but it is my personal opinion. Instead it
> could be great to add an option to customize the output, what do you
> think?

I almost think that customizing output is too much, most people don't 
need that. Maybe just an option to show the seconds, with it off by default.
Details
Message ID
<87cz1nyxi9.fsf@posteo.net>
In-Reply-To
<3e8f00b0-a3b7-3b03-6a1d-4419bfad12d7@djha.skin> (view parent)
DKIM signature
pass
Download raw message
> I almost think that customizing output is too much, most people don't 
> need that. Maybe just an option to show the seconds, with it off by
> default.

Yes, you right. Let's do this instead. Thank you for your feedback :)
Details
Message ID
<877crszhjj.fsf@posteo.net>
In-Reply-To
<87cz1nyxi9.fsf@posteo.net> (view parent)
DKIM signature
pass
Download raw message
>> I almost think that customizing output is too much, most people don't 
>> need that. Maybe just an option to show the seconds, with it off by
>> default.
> 
> Yes, you right. Let's do this instead. Thank you for your feedback :)

I introduced a new option `timer-precision` that can take 3 values:

- `second`: Sets the precision to seconds, which shows hour and/or
  minutes and/or seconds (the one you would like)

- `minute` (default): Sets the precision to minutes. If the timer < 60,
  shows seconds, otherwise shows hours and/or minutes.

- `hour`: Sets the precision to hours. If the timer < 3600,
  shows minutes and/or seconds, otherwise shows hours only.
Reply to thread Export thread (mbox)