sqshq / sampler

Tool for shell commands execution, visualization and alerting. Configured with a simple YAML file.
https://sampler.dev
GNU General Public License v3.0
12.57k stars 550 forks source link

:grey_question: Layout question (jq | column) inside textboxes (deal with t ad \t) #117

Open adriens opened 2 years ago

adriens commented 2 years ago

:point_right: Context

I'm preparing of ready to use sample dashboards. At the end i'll create a dedicated & public GH repo.

:grey_question: Question about alignement

I would like to get the following command in a nice looking way in sampler.

Everything looks fine from the terminal :

curl -s https://hub.docker.com/v2/repositories/optnc | jq -r '"Image\tStars\tPulls", "-----------------------\t-------\t------", ( .results | sort_by(.pull_count) | reverse | .[] | "\(.name)\t\(.star_count)\t\(.pull_count)")' | column -t -s $'\t'

see below :

image

... but when I put the same commad in the following conf (inspired by code sample) :

textboxes:
  - title: OPT-NC Docker image stats
    rate-ms: 15000
    sample: curl -s https://hub.docker.com/v2/repositories/optnc | jq -r '"Image\tStars\tPulls", "-----------------------\t-------\t------", ( .results | sort_by(.pull_count) | reverse | .[] | "\(.name)\t\(.star_count)\t\(.pull_count)")' | column -t -s $'\t'

I get the following render (something weird appears with t and \t) :

image

:point_right: I guess it has to deal with special characters... but in your sample I did not see any special tricks

Any idea about what I'm doing wrong ?... or am missing in formating options ?

Thank you in advance for any help or feedback.