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
ddev help
doesn't respect --json-output
#5567
Comments
I'd be interested in hearing what you're up to :) A contribution here is welcome, but it's not likely to make high priority at this point. Related: |
My current dev environment is a self-rolled symfony console app with a custom docker container. I want to swap to DDEV but I often need to create multiple new projects a day, with specific requirements, and sometimes do things like pull specific PRs into those projects. Doing that with DDEV as-is would require multiple commands for each project setup. DDEV doesn't currently have a way to easily add new commands that work before you have your project set up - from what I can see, even "global" commands only work when you're in the directory of an existing project. So I'm wrapping DDEV so I can have a single executable for my custom commands and existing DDEV commands.
I'll take a look and see what I can see - but I'm not familiar with GO nor with the DDEV codebase so it's not likely I'll be able to put a solution together in the time I have. |
Looks like DDEV is using the default help command provided by cobra, which can be customised - but given I'm not familiar with GO, cobra, nor the DDEV codebase, this is beyond my abilities right now. If someone can point me to the right place to implement the customisation, and give me any pointers about how to go about doing so, I can look at it a bit more... but for now this is as far as I can go. |
Project level host custom commands do work immediately. But consider a little shell script wrapper :) I think you're working way too hard. |
Right... but I need global commands for before a project exists. Not project-level commands.
That would require writing my custom commands as shell scripts, and I'm much more comfortable with PHP. I'm not even sure how to make a shell script wrapper :p so I'll stick with what I know. Regardless of my usecase though, I think this bug report is valid. We should probably keep any discussion about my use-case somewhere else (maybe open a discussion if you want to talk more about it?) to avoid adding too many comments to this issue that don't directly relate to the bug report. |
I would love to have you experiment with Cobra. You already knew enough to find out how it works, you can probably get all the way with it. Quite a number of DDEV users have become golang contributors, docs are quite good, https://ddev.readthedocs.io/en/latest/developers/building-contributing/ |
I've raised #5572 |
Is there an existing issue for this?
Output of
ddev debug test
Expand `ddev debug test` diagnostic information
Which makes sense - this bug report has nothing to do with projects. I don't have any current ddev projects to run the command in, and I don't think the output is relevant so I'm not gonna bother spinning one up unless I really have to.
Expected Behavior
The help information should respect the global
--json-output
or-j
flag, and output its information in JSON format. This would make the output easy to interpret programmatically.Actual Behavior
The output is the same as though you hadn't used the
--json-output
or-j
flag. This means it is not easy to interpret programmatically.Steps To Reproduce
ddev help <command> --json-output
Anything else?
I'm writing a wrapper around DDEV that allows me to further customise the DDEV CLI. Part of this requires being able to programmatically interpret the output from the help command so that my wrapper can use that information to know what flags any given DDEV command will accept, among other things. I'm doing that with REGEX at the moment, but theoretically the way the output is displayed could change tomorrow and break it. If I could get the information as a JSON object, the normal text output could change without breaking my code (along with being easier to fetch the relevant information in the first place).
The text was updated successfully, but these errors were encountered: