Sitelet https://web.archive.org/web/20210122193501/https://github.com/github/linguist/pull/4664
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 for single file classification #4664

Merged
merged 3 commits into from Oct 24, 2019
Merged

Conversation

@lbonanomi
Copy link
Contributor

@lbonanomi lbonanomi commented Oct 5, 2019

This PR attempts to resolve #3562 by outputting JSON-format results for a single file.

Description

Example based on issue:

$ ./bin/github-linguist grammars.yml --json
{"grammars.yml":{"lines":857,"sloc":856,"type":"Text","mime_type":"text/x-yaml","language":"YAML"}}
  • I am adding new or changing current functionality
    • I have added or updated the tests for the new or changed functionality.
Copy link
Member

@lildude lildude left a comment

Thanks for this PR. I think this will do the trick, however it needs a few tweaks.

bin/github-linguist Show resolved Hide resolved
bin/github-linguist Outdated Show resolved Hide resolved
lbonanomi added 2 commits Oct 23, 2019
Per #4664 (comment) @lildude is right, why did I remove this line?
Per #4664 (comment) the `if-not` logic has been inverted
@lbonanomi lbonanomi requested a review from lildude Oct 23, 2019
@lildude lildude requested review from pchaigno and Alhadis Oct 23, 2019
Copy link
Member

@lildude lildude left a comment

Confirmed this works as expected:

$ bundle exec bin/github-linguist grammars.yml --json | jq
{
  "grammars.yml": {
    "lines": 856,
    "sloc": 856,
    "type": "Text",
    "mime_type": "text/x-yaml",
    "language": "YAML"
  }
}
$ bundle exec bin/github-linguist grammars.yml                                                                  
grammars.yml: 856 lines (856 sloc)
  type:      Text
  mime type: text/x-yaml
  language:  YAML
$

Thanks.

@lildude lildude merged commit 770b6e6 into github:master Oct 24, 2019
4 checks passed
4 checks passed
Ruby 2.6.x
Details
Ruby 2.5.x
Details
Ruby 2.4.x
Details
Ruby 2.3.x
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants