fboender / multi-git-status

Show uncommitted, untracked and unpushed changes for multiple Git repos
MIT License
470 stars 73 forks source link

Sort results from find #15

Closed schnapster closed 5 years ago

schnapster commented 5 years ago

The results being returned in a more or less random order is rather unpleasant. When running mgitstatus | sort, the output looses all its colors, that's why I am proposing a change to the script itself. Please let me know if this is too simple of a fix and you'd rather like a switch to allow users to decide if they want the output sorted or not.

fboender commented 5 years ago

Hi Napster!

Thanks for the merge request. While it does solve the problem of sorting, I think the general problem is that mutli-git-status doesn't output colors when using pipes. So not only do you lose colors when using sort, but also when grepping, etc. This was done intentionally, as ANSI escape sequences (colors) in output can be problematic.

I think a better solution is an option to force multi-git-status to output colors. I've gone ahead and implemented that as the -c option. You can find it in the master branch. It lets us do all kinds of pipe-operations without losing colors. E.g.:

mgitstatus -c | grep -v "fboender/multi-git-status" | sort

Let me know if this satisfies your requirements!

schnapster commented 5 years ago

Works lovely, thank you!