Skip to content

Instantly share code, notes, and snippets.

@psu
Last active January 24, 2026 08:42
Show Gist options
  • Select an option

  • Save psu/59c3cc2024af28e76ce1f1cbeb0923d7 to your computer and use it in GitHub Desktop.

Select an option

Save psu/59c3cc2024af28e76ce1f1cbeb0923d7 to your computer and use it in GitHub Desktop.
JQ & Qlerify commands

###############################################

JQ & Qlerify commands -- Pontus Sundén 2024

###############################################

BASICS

List event descriptions

jq '.eventsJson[].description'

List events with type appended (if other than "Task)

jq '.eventsJson[] | .description+(if (.type|contains("Task")|not) then " - "+(.type|match(":(.+)")|.captures[0].string) else "" end)'

List swimlanes

jq '.lanes[] | .name'

List custom definitions

jq '. | to_entries[] | select(.key | endswith("Definition") ) | .value | .title+": "+.description '

List all cards

jq '.eventsJson[] | .requirementsJson[]? | .description'

List card of type $select

jq --arg select "system" '.eventsJson[] | .requirementsJson[]? | select((.cardType.title|ascii_downcase)==($select|ascii_downcase)) | .description'

ADVANCED

Output headerless CSV with: event_position, event_description, card_type, card_description

jq --raw-output ' .eventsJson | to_entries | map(.value.position=.key+1) | map(.value) | .[] | .description as $parent | .position as $position | .requirementsJson[]? |
[$position, $parent, .cardType.title, .description] | @csv |
gsub("

(\s|<br(\s/)?>)

";"";"m") | gsub("<br(\s/)?>|

\s

";"\n") | gsub("<[^>]*>";"") '

UTILS

Include an element "position" denoting position for each object in an array

#replace this jq '... | .arrayOfObjects[]' #with this jq '... | .arrayOfObjects | to_entries | map(.value.position=.key+1) | map(.value) | .[]'

Strip HTML

jq '... | gsub("<[^>]*>"; "")'

Try to keep newlines, then strip HTML

jq '... | gsub("

(\s|<br(\s/)?>)

";"";"m") | gsub("<br(\s/)?>|

\s

";"\n") | gsub("<[^>]*>";"")'

Include first two characters of UUID

jq '... +" [" + (.id | match("^.{2}") | .string) + "]"'

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