~torresjrjr/fetch

5d20b4a9ac4868f8b56270f0c654932d274cc79f — Byron Torres 9 months ago abf538d
Revert 015c94b "Use ps formatting to simplify..."

This reverts commit 015c94bcd508cd0fa74ed9eb6dfcd8d60a447e68.

The ps -c flag was not portable on MSYS2.

Note: BSD-style flags also don't work on MSYS2, but fall back gracefully
instead. Default MSYS2 ps lists all MSYS2 proccesses anyway.
1 files changed, 3 insertions(+), 5 deletions(-)

M fetch
M fetch => fetch +3 -5
@@ 56,15 56,13 @@ _shell() {
	printf "$1"  "$(readlink /proc/$PPID/exe)"
}
_sshd() {
	pids=$(ps axc -o 'pid,comm' | awk '/sshd/{printf $1 "   "}')
	pids=$(ps ax | awk '!/awk/ && /sshd/ {printf $1 "   "}')
	printf "$1"  "${pids:---}"
}
_tmux() {
	ps axc -o 'comm' | grep -q 'tmux: server' && tmux_sessions=$(
	ps ax | grep -v 'grep' | grep -q 'tmux' && tmux_sessions=$(
		tmux ls -F "#{session_created} #{?session_attached,$ul,}#S:#{session_windows}$c0" \
		| sort \
		| awk '{printf $2 "   "}' \
		| xargs -0 printf
		| sort | awk '{printf $2 "   "}' | xargs -0 printf
	)
	printf "$1"  "${tmux_sessions:---}"
}