-
Notifications
You must be signed in to change notification settings - Fork 56
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 (machine readable) status output #1210
Comments
Wowow that's a novel idea... could you elaborate on how what kind of integrations do you consider? so far I'd rather expected that the tool is only ever used by human users directly, and not by scripts (other than maybe some scripts like git hooks or shell completion for git-machete itself, hence git-machete defines some plumbing commands of its own). |
Honestly, the simplest case is just github/gitlab integration. We have an internal machete-to-github PR management tool that wraps machete. However, as we all know, PR flows are ... highly opinionated ... matters; Having a plumbing-level command for status output would let us easily integrate with machete; In slightly-less-simple cases, we have actions workflows built on machete that do things like auto-merge of stack machete trees. In the way-far-afield-future I could imagine a status-json interface supporting a VSCode extension for machete. |
I wasn't aware you've got such complicated machinery on top of git-machete 😯 sure, feel free to open the PR! I'm currently busy with GitLab integration btw (#1189), this is gonna take me while (even though the API is strikingly similar to GitHub's) :/ Also, as you probably know, we've got an IntelliJ plugin that covers most of the features of CLI (even traverse; but notably, GitHub integration is still missing). There's unfortunately no easy way to quickly port it to a VSCode extension :/ |
Overview
git machete
is a mega-useful workflow tool,partially because is nicely separates the current branch state (the git repo state) from a declared target state (the machete config).
It'd be real useful to be able to overlay workflow helpers or lightweight views onto
git machete
;which would be much easier if there was an easily-parsed output format.
Most interactions with machete can be represented as:
git machete status
to get the branch tree and branch status information.git
orgit machete
command to do the needful.Therefor, we can implement most integrations by only adding output
git machete status
.Semi-obviously, this should just be a json form of the status output.
In my experience, this best represented as an adjacency based structure akin to the output of the
git machete show
commands.In dataclasses:
This can be semi-trivially generated during machete's current
status
implementation.The easiest implementation might be to just add a
--json
flag togit machete status
?Happy to open a PR for comments if you're open to it.
The text was updated successfully, but these errors were encountered: