Skip to content

Instantly share code, notes, and snippets.

@citizenmatt
Last active June 29, 2026 23:49
Show Gist options
  • Select an option

  • Save citizenmatt/8731ef6174a0b29b3d0905fc09040903 to your computer and use it in GitHub Desktop.

Select an option

Save citizenmatt/8731ef6174a0b29b3d0905fc09040903 to your computer and use it in GitHub Desktop.
Syntax highlighting for `lore --json` commands using `grc` generic colouriser

Lore, the new version control system from Epic Games, has a very nice feature to render CLI output as JSON, by using the --json command line argument. For example, lore --json history. If you have the grc generic colouriser app installed to provide syntax highlighting for other CLI commands, you can use the following config to show this JSON output as syntax highlighted.

  1. Create and edit ~/.grc/grc.conf to match lore --json (with trailing text) and use the conf.json config file for the output
  2. Create and edit ~/.grc/conf.json to describe the syntax highlighting patterns and config (note that GitHub's gists don't like a file ending .json that isn't actually a JSON file)
# this configuration file is suitable for displaying structured json logs
# Reference: http://kassiopeia.juls.savba.sk/~garabik/software/grc/README.txt
# attribute name
regexp=(?<=[\{,])\".*?\"(?=\:)(?!,)
colours=bold white
count=more
======
# attribute value (string)
regexp=(?<=\:\").*?[^\\](?=\")
colours=green
count=more
======
# attribute value (number)
regexp=(?<=\:)[-+]?[0-9]*\.?[0-9]+
colours=bold magenta
count=more
======
# attribute value (date)
regexp=\"\d{4}-[01]\d-[0-3]\d.+?\"
colours=cyan
count=more
======
# special attribute (error)
regexp=(?<=[\{,]\")err.*?\"\:\".*?[^\\](?=\")
colours=bold red
count=more
=====
# special attribute (error level)
regexp=(?<=[\{,]\"level"\:)(\"(err.*?|fatal|ftl)\")
colours=bold on_red
count=once
=====
# special attribute (warning level)
regexp=(?<=[\{,]\"level"\:)(\"(warn.*?|wrn)\")
colours=on_yellow black
count=once
=====
# useful delimiters
regexp=([\[\]\{\}\(\)])
colours=dark white
count=more
=====
# useful delimiters
regexp=(?<=\"),(?=\")
colours=dark white
count=more
# Lore JSON command profiling
\blore\s+.*--json\b.*
conf.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment