Skip to content
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

Start to generate man pages automatically #1342

Merged
merged 1 commit into from Jan 24, 2018
Merged

Conversation

wilzbach
Copy link
Member

Turns out that generating man pages automatically isn't hard.
See also: #1143 (manual approch).

This is far from ideal, but it does generate man pages for all commands and
thus should get us started.

@dlang-bot
Copy link
Collaborator

Thanks for your pull request, @wilzbach!

@wilzbach wilzbach mentioned this pull request Jan 15, 2018
@s-ludwig
Copy link
Member

Nice! Is there anything left in the manual work that we should get in somehow?

The only thing is that this should be put in the "scripts" folder instead of creating its own top-level one.

@wilzbach
Copy link
Member Author

Nice! Is there anything left in the manual work that we should get in somehow?

  • "see also" is more sophisticated on the manual PR, but I don't think this is crucial
  • dub.sdl / dub.json page (this2 can be done in a separate PR)

BTW the CLI output for a command lists the common option too. I left them out for now as #1143 didn't add them either, but thinking about it, we should probably add them too

The only thing is that this should be put in the "scripts" folder instead of creating its own top-level one.

Done. Other changes:

  • added it to the Travis script
  • made the synopsis text dynamic
  • fixed newline output for DESCRIPTION
  • check for acceptAppArgs
  • check for single / long arguments

Well, this doesn't aim to be perfect on the first try. I am pretty sure that some small modifications will be needed, but I think this brings us to 95% of the solution.

Copyright (c) 1999-%s by The D Language Foundation
.SH "ONLINE DOCUMENTATION"
.UR http://code.dlang.org/docs/commandline
.UE http://code.dlang.org/docs/commandline
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this. In the preview this doesn't generate a URL, but it's the way DMD documented it's ONLINE DOCUMENTATION.

auto manFile = File(config.cwd.buildPath(fileName), "w");
auto manName = format("DUB-%s", command.name).toUpper;
manFile.writeHeader(manName, config);
static immutable seeAlso = ["dmd(1)".br, "dub(1)"].joiner("\n").to!string;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be more sophisticated.

@s-ludwig
Copy link
Member

Sounds like a good start!

@s-ludwig s-ludwig merged commit 5a90a4a into dlang:master Jan 24, 2018
@wilzbach wilzbach deleted the man branch January 31, 2018 16:02
@wilzbach wilzbach mentioned this pull request Feb 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants