-
Notifications
You must be signed in to change notification settings - Fork 23
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
One manpage per subcommand output #45
Comments
Hi @langston-barrett , is there any chance you or any other maintainer will implement this? I am willing to help but would need some help. Tried to look into the code and it's a little over my head unfortunately. If someboday tells me where my starting point would be, that might help already. So in short my feature idea is: Rendering only the output of the main command but leave out all the subcommands.My suggestion would be to use the already existing maxdepth argument. Setting it to 0 would leave out subcommands. I think this would be a self-explanatory thing but certainly I would include an addition to the autoprogram docs in my PR. |
I'm currently the only maintainer. I'm not personally interested in this feature, so I'm unlikely to implement it. However, I'm happy to review any PRs with this feature.
I bet you could fix this by making autoprogram/sphinxcontrib/autoprogram.py Line 61 in d9e47cf
and changing the conditional here to be autoprogram/sphinxcontrib/autoprogram.py Line 65 in d9e47cf
You'd also need to change the line here that sets the default value: autoprogram/sphinxcontrib/autoprogram.py Line 194 in d9e47cf
Hope that helps! |
Hi @langston-barrett, BUT I also then recalled what the actual problem was back then: There is a nasty bug that prints the subcommands program name wrongly named as "sphinx-build". In the end it lands in a variable called title which I think is then used in the final rendered document. So for example having these two rst files, one for the main command only, and for the subcommand only (it's a different program than in my first post but I think that doesn't matter, it's the same behaviour in both of them): provision.rst .. autoprogram:: lib_provision.cli:get_parser()
:prog: provision
:maxdepth: 1
:no_usage_codeblock: provision_install.rst
Ok, so basically it works, Im am getting two html pages, one with the main command and one with only the subcommand. I put some debug statements in the code, let's see where it goes wrong with the program name:
I think you see what the problem is. I am unsure why this goes wrong. And also am unsure at which place it would be correct to fix it. Well, yes I could just quickfix it at the point where "title" variable is assigned by just replacing sphinx-build with the actual main program name but I think this wouldn't be appropriate and the fix should be somewhere much earlier in the code. Also good to know is that this bug only occurs when as in my example autopgrogram is called twice / is in two rst files - one with main maxdepth 1, one with subcommand maxdepth 1 (or higher) If I just render provision_install.rst - everything is fine the output looks like this:
|
Alright, I think I am almost there. Added some more debug statements: around these lines: autoprogram/sphinxcontrib/autoprogram.py Lines 217 to 218 in d9e47cf
Ok, so it seems that in the first case, with both rst files, "original_prog" is set to provision and that's why the if condititon is not true and sphinx-build does not get replaced with the value of "prog" |
Also I think I am mixing up two issues here. Sorry for that but it just happened, so to clarify we are talking about these issues:
I am investigating issue 2 at the moment. Note that issue 2 also applies to generating manpages even though my current examples do "make html" Hope that helps tidying up any confusions :-) |
Hi @langston-barrett, do you agree that this could be fixed by replacing this: autoprogram/sphinxcontrib/autoprogram.py Lines 232 to 233 in d9e47cf
with something like that (excluding debug print statements)
but probably I am too short-sighted here as I a don't understand why the If my assumption is true then I also don't understand why the ìf startswith` in this similar instance of that if statement a little further above in the code was necessary. Again here: If I state :prog: explicitly in the directive, I always want it to be replaced, right? autoprogram/sphinxcontrib/autoprogram.py Lines 217 to 218 in d9e47cf
|
Hi |
Is it possible to output multiple manpages/html pages eg for commands with multiple subcommands and a lot of options? I'd like to have the main command in a page and each subcommand in a separate page.
I try as follows but don't get the expected results.
Main command rst file - I try to remove all subcommands in the output my setting maxdepth: 0 but it does not work. Still all subcommands are included in the
disco
section:one of the subcommand rst files - works as expected, only the
disco search
command is shown:I have some index rst files too and in html output what I am trying to achieve looks quite good already, except the main command issue. These are the index files:
In manpage output I still get one big manpage, containing all subcommands. How can I control that pages should be separated?
The text was updated successfully, but these errors were encountered: