ingydotnet / git-hub

Do GitHub operations from the `git` command
MIT License
794 stars 62 forks source link

Invalid JSON output: trailing comma in some cases #225

Closed perlpunk closed 8 years ago

perlpunk commented 8 years ago

In some cases, -j will produce JSON with a trailing comma:

% git hub repo -j
{
    "full_name": "perlpunk/git-hub",
    "description": "Do GitHub operations from the `git` command",
    "language": "Shell",
    "html_url": "https://github.com/perlpunk/git-hub",
    "ssh_url": "git@github.com:perlpunk/git-hub.git",
    "forks": 0,
    "parent/full_name": "ingydotnet/git-hub",
    "source/full_name": "ingydotnet/git-hub",
    "watchers": 1,
    "open_issues": 0,
    "pushed_at": "2016-05-13T19:53:33Z",
    "created_at": "2015-06-02T19:31:17Z",
}

This happens because of a little mistake in the loop logic in lib/git-hub.d/json-setup.bash pretty-json-object()

Without the check for -n this would be the last line:

    "privatex": 
perlpunk commented 8 years ago

Fixed the same bug in pretty-json-list() also

ingydotnet commented 8 years ago

Applied. Pushed. Thanks. \o//