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

Add JSON output option #152

Open
Dzordzu opened this issue Jan 9, 2021 · 3 comments
Open

Add JSON output option #152

Dzordzu opened this issue Jan 9, 2021 · 3 comments
Labels
enhancement New feature request or implementation

Comments

@Dzordzu
Copy link

Dzordzu commented Jan 9, 2021

Depends on

Proposal

Add a new flag (ex. --porcelain; like in git) that will result in easy to parse output.

Reason

It's quite to parse any output from this amazing tool

Suggested output format

$ERROR_CODE;$PATH_TO_FILE;$PATH_TO_LINK

Example Output

404;./people/mq/01_people.md;.../auth/01_general_concepts.md
403;./people/mq/02_people_address.md;../localization/01_general_concepts.md

Details

Name Value
Urgent No
Complexity ?
OP Support No (at least until 2021.06
@NicolasMassart
Copy link
Contributor

Two comments:

Git

I don't think we should copy Git naming for these options... Git is not the software I would use as a UX example... we get used to it, but it's not intuitive. It's my own opinion and I use it almost since it exists...

Output format

if we output a machine readable format, why not just an already established format? I suggest outputing JSON directly as you can handle it in most languages, and even using shell scripts jq or alike can be used. Option could then be -j, --json. And outputting JSON from a JS software feels very natural.

See for instance what Heroku app does: https://devcenter.heroku.com/articles/heroku-cli-commands

This is something explained also in https://clig.dev/#output and I think we should follow these guidelines:

Display output as formatted JSON if --json is passed. JSON allows for more structure than plain text, so it makes it much easier to output and handle complex data structures. jq is a common tool for working with JSON on the command-line, and there is now a whole ecosystem of tools that output and manipulate JSON.

@Dzordzu
Copy link
Author

Dzordzu commented Jan 11, 2021

  1. I mentioned git as an example (to define what I would like to describe). Using any other flag would be great (for example -j, as you suggested)
  2. Good point. JSON would be much better

@NicolasMassart NicolasMassart changed the title [Feature request] Add easy to parse output mode Add easy to parse output mode Jan 11, 2021
@NicolasMassart NicolasMassart changed the title Add easy to parse output mode Add JSON output option Jan 11, 2021
@NicolasMassart NicolasMassart added the enhancement New feature request or implementation label Jan 11, 2021
@coanor
Copy link

coanor commented Jan 13, 2023

Need the feature for large document repository.

JSON is pretty,current output format hard to parse using simple grep/sed/awk skills. The following shell would extract 404 errors, but not precisely get the result I need:

sed -n '/^FILE: /,/[✖]/p' /path/to/deadlink-output.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature request or implementation
Projects
None yet
Development

No branches or pull requests

3 participants