-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
json support #150
Comments
Is there any advances on this ? Being even bolder: I think always think of spf13/viper for parsing serialized configuration/spec files. Also, you end up with full support for at least 3-4 major formats, and the other ones supported by viper are just added bonus, should anyone wish to write a spec into an INI file... |
It shouldn't be too complicated as the spec is rather simple. Think viper had quite a lot of dependencies and wouldn't give much advantages in this case. |
Viper: yes I forgot how large the dependency list is, forget about this. JSON: if I'm not mistaken, everything supported on YAML is also supported on JSON. Just thinking out loud about potential compatibility problems down the road. Third party tools for conversion: maybe you didn't mean this the way I heard it. However if you did more or less, I would like to argue that asking people to manage third party tools for this matter is not practical. Happy to help if you'd like a mock or something. |
There shouldn't be any issues with json just maybe having the annoyance of having both tags on the command struct. With third-party tools i means ones like yj as it might be better to explicitly not support a different format than |
Macros: can't say anything as I've neither tested nor looked at the macros code (just flown above it once). Yj tool: it can be used as a library, so you might be interested in this if you want to remain self-contained.
To be clear, uses of the pronoun "your" targets your carapace internal code, not any consumer of the libraries. |
Yes providing the conversion is something i have considered as well as the dependencies for it are already present anyway (no need for yj in this case). |
By the way, related to #655, at some point it might be very very useful to load completion specs from directories/files/streams outside of I know that it's possible to write a completer for this, with the various exports/command function helpers in your library, but I am pretty sure that this will be a pain when registering commands in bulks (which is the case in the other repo issue mentioned above). That is, it's easy for a given positional completer to link to another command completer spec (a la git-command), but it requires every command to declare this positional completer. Take this comment with a pinch of salt though, I've not experimented enough with this for being entirely positive. |
For not allowing JSON into the specs directory, I only have obvious suggestions for it (add a json subdir, or some other ideas). I'm pretty sure you already have those in mind anyway, so I can't help further here. |
Another ping here to know if there are advances as far as devising what's possible and what's not:
carapace.ReadSpec(rootCmd, "path/to/spec/dir-or-file") This would bind all specs found in the dir as subcommands of the Maybe there is an equivalent to that in carapace already that I would have missed ? Will try to open a PR for the sake of mocking this. |
Haven't decided to actually support JSON yet.
It's at least planned for carapace-bin: carapace-sh/carapace-bin#1336
I'm considering a dot-delimited approach: #91 (comment) |
Request
Lots of frameworks and languages have json support out-of-the box but yaml would introduce an additional dependency.
Proposed solution
Provide secondary support for json (import/conversions).
Anything else?
No response
The text was updated successfully, but these errors were encountered: