Skip to content

Instantly share code, notes, and snippets.

@Mostly-BSD
Last active September 1, 2019 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mostly-BSD/d1afcbb15517577acfcd0197b17e10e4 to your computer and use it in GitHub Desktop.
Save Mostly-BSD/d1afcbb15517577acfcd0197b17e10e4 to your computer and use it in GitHub Desktop.
Colorized outout of Void Linux's xbps-query and sv status commands

Instructions

Just some color for xbps-query and sv status commands.

  • xbps-install grc
  • Copy the attached 2 files in /usr/share/grc/
  • xbps-query -Rs <sreach-string> | grcat /usr/share/grc/conf.xbps-query
  • sv status /var/service/* | grcat /usr/share/grc/conf.sv
  • Enjoy!

Screenshots

Imgur

Imgur

# Name
regexp=:\s\/var\/service\/([^:]+):
colours=unchanged,yellow
-
# PID
regexp=\(pid (\d+)\)
colors=unchanged,magenta
-
# down
regexp=down:
colours=red
-
# down
regexp=(down):.*(normally up)
colours=unchanged,bold red,bold red
-
# running
regexp=run:
colours=green
-
# Recently Started Processes
regexp=\s+(\d\d?)s
colours=yellow
-
# Medium Age Processes
regexp=\s+(\d\d\d)s
colours=cyan
-
# Old Processes
regexp=\s+(\d\d\d\d+)s
colours=unchanged
# Status Installed
regexp=^\[(\*)\]
colours=unchanged,bold green
-
# Status Not-Installed
regexp=^\[(-)\]
colours=unchanged,red
-
# Package
regexp=^\[.\]\s+([^ ]+)-\d[0-9-_\.A-Z-a-z]+\s
colors=unchanged,yellow
@archfan
Copy link

archfan commented Nov 28, 2018

Thanks for this. Looks much better! Here are the aliases I've added to my .zshrc

alias serviceStatus="sv status /var/service/* | grcat /usr/share/grc/conf.sv"
alias searchSW='f() { xbps-query -Rs $1 | grcat /usr/share/grc/conf.xbps-query };f'

@Mostly-BSD
Copy link
Author

@archfan I knew the reader would be smart to figure the last piece out. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment