Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty printing the |-separated result fields #2

Open
Fraasi opened this issue Apr 8, 2023 · 0 comments
Open

Pretty printing the |-separated result fields #2

Fraasi opened this issue Apr 8, 2023 · 0 comments

Comments

@Fraasi
Copy link
Owner

Fraasi commented Apr 8, 2023

Depending on what you search, you might get these kind of result fields:

$ wac orange fruit
...
Vitamins:
   | | mean value | % daily value | range
  vitamin A | orange | 17 μg | 1% | (15 to 18) μg
   | fruit | 24 μg | 2% | (0 to 237) μg
  vitamin C | orange | 78 mg | 130% | (63 to 100) mg
   | fruit | 68 mg | 114% | (0.0014 to 2.3) g

Minerals:
   | | mean value | % daily value | range
  calcium | orange | 66 mg | 7% | (56 to 98) mg
   | fruit | 32 mg | 3% | (1.4 to 301) mg
  iron | orange | 340 μg | 2% | (0.13 to 1.1) mg
   | fruit | 801 μg | 4% | (0 to 3.9) mg
...

These are too hard to read, you can pipe the whole output to column -t -s'|', but that formats the whole output so that the first column is as wide as the widest sentence in the whole output... so this is useful for only in certain occasion. eg:

$ wac zodiac signs | column -t -s'|'
Input interpretation:
  traditional zodiacal signs
Result:
  Aries                        ♈    March 21- April 19
  Taurus                       ♉    April 20 - May 20
  Gemini                       ♊    May 21 - June 20
...

So the only way to fix this, is to format the result in jq, BUT...

Might have to rewrite this in another language... Sigh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant