netologist / theme-lambda

lambda theme for oh my fish
MIT License
63 stars 43 forks source link

cmd_duration prints a warning on each command on OSX #11

Open Ludonope opened 4 years ago

Ludonope commented 4 years ago

The following line from the right prompt generates a warning on macOS High Sierra 10.13.6

printf ' < %s' (_convertsecs (math $cmd_duration / 1000))

Output:

╰─λ cd                                                       0 < 00: < 11:20:44
0.000017: value not completely converted
╭─ludonope at Ludonope-MacBook-Pro in ⌁
╭─ludonope at Ludonope-MacBook-Pro in ⌁erted                 0 < 00: < 11:20:55
╰─λ

If I comment that line I get the correct behavior

DCjanus commented 4 years ago

Same issue for me, not only Mac with Iterm2, but also ArchLinux(Alacritty).

SergeyNosov commented 4 years ago

Same issue. I fixed the file fish_right_prompt.fish. Just added -s0 parameter after math command. It solved the issue.

function _convertsecs
 printf "%02d:%02d:%02d\n" (math -s0 $argv[1] / 3600) (math -s0 (math $argv[1] \% 3600) / 60) (math -s0 $argv[1] \% 60)
end
RobinVanhove commented 4 years ago

@SergeyNosov thank you, could you maybe create a pull request?

janwerkhoven commented 4 years ago

+1 I am experiencing the same issue, fix is much welcomed 🙏 lambda is my favourite Fish theme

janwerkhoven commented 4 years ago

I can confirm @SergeyNosov 's fix is working. I've added his code to ~/.local/share/omf/themes/lambda/fish_right_prompt.fish and the errors disappeared. Thanks!

janwerkhoven commented 4 years ago

It seems we have 2 PRs open to solve this issue:

https://github.com/hasanozgan/theme-lambda/pull/12 https://github.com/hasanozgan/theme-lambda/pull/13

@hasanozgan please review and merge in 🙏

Ludonope commented 4 years ago

It seems like those two were merged, but it's now missing and end keyword to close the __print_duration function.

@hasanozgan could you please look into it? The fix is pretty straightforward ^^

mzalaya commented 4 years ago

this bug was annoying me for a long time. I just added the function function _convertsecs printf "%02d:%02d:%02d\n" (math -s0 $argv[1] / 3600) (math -s0 (math $argv[1] \% 3600) / 60) (math -s0 $argv[1] \% 60) end to my fish_right_prompt.fishfile @SergeyNosov: THANKS!