mission-control-indexer
mission-control-indexer copied to clipboard
indexercli has control / escaped charachters in output
If you run :
graph indexer rules get all --output yaml > test.yaml
graph indexer rules get all --output json > test.json
it'll have invisible characters in the output, which is a problem to process with other tools.
YAML :
^[[0m- deployment: global^[[0m
^[[0m allocationAmount: "0.01"^[[0m
^[[0m parallelAllocations: "2"^[[0m
^[[0m maxAllocationPercentage: null^[[0m
^[[0m minSignal: null^[[0m
^[[0m maxSignal: null^[[0m
^[[0m minStake: null^[[0m
^[[0m minAverageQueryFees: null^[[0m
^[[0m custom: null^[[0m
^[[0m decisionBasis: never^[[0m
JSON :
^[[0m[^[[0m
^[[0m {^[[0m
^[[0m "deployment": "global",^[[0m
^[[0m "allocationAmount": "0.01",^[[0m
^[[0m "parallelAllocations": "2",^[[0m
^[[0m "maxAllocationPercentage": null,^[[0m
^[[0m "minSignal": null,^[[0m
^[[0m "maxSignal": null,^[[0m
^[[0m "minStake": null,^[[0m
^[[0m "minAverageQueryFees": null,^[[0m
^[[0m "custom": null,^[[0m
^[[0m "decisionBasis": "never"^[[0m
^[[0m }^[[0m
^[[0m]^[[0m
This is because the cli apparently outputs a colored scheme and pipes can't handle them by default.
If you want to escape the characters do this, for example:
graph indexer rules get all --output json | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" > test.json
More information here: https://stackoverflow.com/questions/17998978/removing-colors-from-output
For me it worked with just this |sed 's/\x1b\[[0-9;]*m//g'
At least that way anything not belonging wasn't anymore in the resulting file. This makes jq happy too.
graph indexer rules get all --merged --output json |sed 's/\x1b\[[0-9;]*m//g' | jq