Hacker News new | ask | show | jobs
by santix 2726 days ago
I was hoping to see that they added a `time` command, which is something that makes me change to bash every once in a while.
1 comments

There's an actual program, usually installed in /usr/bin/time. The shell builtin is not really necessary.
There's an outstanding issue in the github because the binary doesn't let you directly time fish functions. You can do

time fish -c '[function]'

but that includes the time to launch fish.

This, of course, wouldn't matter for any reasonable usecase but I like a fancy prompt and don't like waiting for it to run.

Ah, timing other shell functions is a use case I hadn't considered. Yes, then you're out of luck I suppose.
I think $duration is a thing, which is the time it took to run the previous command. It doesn't separate things like time does, but it's still useful for some cases.

In fact, I customized my prompt to pretty print the previous command's duration if it took longer than 3 seconds or something like that.

I use the Spacefish prompt plugin[0], which does that as well, and comes with a whole lot of other goodness!

[0] https://github.com/matchai/spacefish