Adam Porter

Results 2645 comments of Adam Porter

This would be handy. I just added a right-prompt that shows the date, time, and the execution time of the last command. But since my left-prompt is a 2-line prompt,...

Thanks, I had forgotten about `$COLUMNS`! And `printf` lets you print a number of characters to pad input, so this works for me (using `wc` instead of `string` since I...

Hey Stefan, Thanks for sharing that code, it looks pretty nice. I remember having an issue with calculating the length of strings containing color codes too, but I didn't think...

@stefanmaric By the way, I copied your Perl expression into sed and it seems to work fine, e.g.: ``` fish $ function test_color set_color red echo four set_color normal end...

> fish's string builtin should work faster than using either sed or perl, since it won't fork to another program. @Darkshadow2 Yeah, thanks for testing that. I still have Fish...

@kairuku > I'm wondering if there's a way to make the git segment of the prompt maintain the same background as the rest of the top line? Good question. The...

Yeah, AFAIK, trapping to cleanup when interrupted is pretty standard in shell scripts, e.g.: ``` sh #/bin/bash cleanup() { rm -f $tempfile } tempfile=$(mktemp) trap cleanup INT TERM ``` You...

> No, because the intent is for the caller to be unaware that some cleanup actions might be needed. If I write a nifty_cool_function and you want to use it...

The idea of a function with hidden side effects modifying the state of the current shell shivers me timbers. :)

Another reason to move to 2.7+ is the addition of helpful modules to the standard library, like `OrderedDict`.