Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd_duration prints a warning on each command on OSX #11

Open
Ludonope opened this issue Oct 14, 2019 · 8 comments
Open

cmd_duration prints a warning on each command on OSX #11

Ludonope opened this issue Oct 14, 2019 · 8 comments

Comments

@Ludonope
Copy link

Ludonope commented Oct 14, 2019

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
Copy link

DCjanus commented Oct 24, 2019

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

@SergeyNosov
Copy link
Contributor

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
Copy link

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

@janwerkhoven
Copy link

janwerkhoven commented Jan 14, 2020

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

@janwerkhoven
Copy link

janwerkhoven commented Jan 14, 2020

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
Copy link

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

#12
#13

@hasanozgan please review and merge in 🙏

@Ludonope
Copy link
Author

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
Copy link

mzalaya commented Jul 2, 2020

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants