steveukx/git-js

Parsed output of git instead of raw

Closed this issue · 1 comments

Some simple-git API returns parsed git output as JavaScript object while others return raw string from git. Is there intention to have all simple-git API (other than raw) to return parsed output?

For example, .listRemote([options]) currently returns raw string from git ls-remote which is not directly usable by logic (not easily anyway without parsing the raw string first).

Hello. As you have noticed, not all tasks have an associated parser:

https://github.com/steveukx/git-js/tree/main/simple-git/src/lib/parsers

The .listRemotes interface can be replaced with .getRemotes(verbose) which returns either a RemoteWithoutRefs[] or RemoteWithRefs[] depending on the verbose argument.

I am happy to accept pull requests for parsers, so if you notice one is missing please consider writing a parser.