Skip to content

Instantly share code, notes, and snippets.

@yannleretaille
Last active October 9, 2016 21:53
Show Gist options
  • Save yannleretaille/f17856b674e6f332837178add538fb77 to your computer and use it in GitHub Desktop.
Save yannleretaille/f17856b674e6f332837178add538fb77 to your computer and use it in GitHub Desktop.
rust - generate private docs for binary project
#!/bin/bash
### RUST - CREATE PRIVATE DOCS FOR BINARY PROJECT
## this command will generate the full docs of your current project and place them in /target/doc_priv
##
## generating full docs for binary projects is not yet fully supported by cargo doc, hopefully this will be obsolete one day
## Sources:
## https://stackoverflow.com/questions/29378113/how-can-i-include-private-modules-when-generating-documentation-via-cargo
## This file was orginally published as gist here:
## https://gist.github.com/yannleretaille/f17856b674e6f332837178add538fb77
RCMD=$(cargo doc --no-deps -v 2> >(awk 'match($0,/`(rustdoc src\/main\.rs.+)`/,res){print res[1]}')| awk 'sub(/target\/doc/,"target/doc_priv")')
$($RCMD --no-defaults --passes strip-hidden --passes collapse-docs --passes unindent-comments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment