-
Notifications
You must be signed in to change notification settings - Fork 156
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
Improve CLI's support for scripting and automation #57
Comments
I agree this is sorely needed. I'm desperately trying to get back to Mutagen development to work on it, because there's a lot more that I want to do, and I know people are waiting. It's highly likely that I'll be hammering out new code for Mutagen as of Thursday, maybe even tomorrow. There was some previous discussion on this particular issue in #48. The JSON output option is an interesting idea. The Protocol Buffers messages used for the daemon gRPC API already define a canonical JSON serialization format, though I'm not sure it's very pleasant or idiomatic. It wouldn't be hard to make JSON work somehow though. I'd also like to prototype a simple line-based format for piping into shell scripts that don't have JSON parsing readily available, but there's no reason that there couldn't be a Also, as described in #51, I think some thought needs to be given to the many-conflict scenario and what to do with that, especially if doing streaming monitoring, but the solution will probably be the same for JSON and other formats. As people start to bring in contributions (which are all very much appreciated), I'd like to set up some contributing guidelines, as well as a CLA or similar. I have some ideas for other projects that I want to build on top of Mutagen and I want to make sure that Mutagen itself stays open-source and free of any licensing problems for me and everyone else. I honestly wasn't expecting contributions so soon, so I wasn't really prepared for it. I'm working on it though! |
No rush, working on open source is time consuming and more often than not they are side projects. Take your time. I'm creating the tickets based on pain points I've been feeling as working with the tool but they are not urgent since most of the limitations can be worked around. In terms of contribution, having guidelines would be helpful. I'd be willing to contribute but I don't want to spend the time going in the wrong direction, etc. About this specific JSON, I think the gRPC JSON serialization would be good enough for most cases and a great starting point. Parsing JSON from shell/CLI is not hard with tools like jq |
@havoc-io in the distant future, it would be great to support a conflict resolution API for mutagen. The current strategy of "await FS resolution" works great for interactive sessions, but for anyone wrapping mutagen in other tools, it passes the burden of remote-control onto those users. Imagine being notified of a conflict in an IDE that wraps mutagen via It would be easier for a consumer to wrap a command like |
@justjake I'm hoping that the new synchronization modes described here (in particular I've actually prototyped this a bit, but the main issue I ran into was how it interacted with synchronization cycle timing. My naïve approach was to try to pass some sort of resolution map into the Thinking about it now, an even "naïve-r" approach might be for a I'll let the idea stew for a bit longer, but it's on the radar. Let's see how the new synchronization modes shake out over this release. |
I wrote a python application mutagen-helper, just released today, that wraps mutagen binary and can help to manage your sessions. Put configuration in a yaml file in a directory to sync, and run You may look at sources as it contains a class that can execute mutagen commands and parse output, but of course as soon as a public API will be available, it could be dropped :). |
One quick update on this front: Mutagen v0.9.0-beta2 brings label/selector support for sessions, which should make a number of scripting operations significantly easier (since there's no longer any need to track session IDs). It's designed to be comparible with the syntax that Kubernetes uses (since it actually re-uses the Kubernetes implementation). There are also new I'll leave this issue open as there is still more to be done here. In particular, I think it would be nice to be able to stream monitoring output in different formats. |
Mutagen v0.15 now supports custom output formatting (using Go templates) in its |
Mutagen CLI is very user friendly but not so much when trying to automate. Specifically, the output of the commands are not easy to parse.
It would be nice to provide an option to control the output. Some examples and suggestions:
mutagen create
Currently,
If mutagen is being called from a program, it's unnecessarily hard to get the session ID. Instead, it would be nice to have a way to simply print the ID.
mutagen list
Currently,
This is very hard to parse, it would be really nice to have a machine friendly output. Something like a JSON output would be ideal.
others?
There are possible other commands that could be improved but those two would make it a lot simpler to interact with mutagen from scripts.
Is this something you're willing to add/change? I would be happy to try and help if you give the 👍 .
The text was updated successfully, but these errors were encountered: