@@ -12,7 +12,14 @@ pub(crate) enum Subcommand {
1212 no_git : bool ,
1313 } ,
1414 #[ structopt( about( "Generate book" ) ) ]
15- Book ,
15+ Book {
16+ #[ structopt(
17+ long = "no-git" ,
18+ help = "Skip book contents require a Git repository. Currently this only includes the \
19+ changelog."
20+ ) ]
21+ no_git : bool ,
22+ } ,
1623 #[ structopt( about( "Generate the changelog" ) ) ]
1724 Changelog ,
1825 #[ structopt( about( "Print a commit template to standard output" ) ) ]
@@ -77,7 +84,7 @@ impl Subcommand {
7784 }
7885 Self :: CompletionScripts => Self :: completion_scripts ( & project) ?,
7986 Self :: Readme => Self :: readme ( & project) ?,
80- Self :: Book => Self :: book ( & project) ?,
87+ Self :: Book { no_git } => Self :: book ( & project, no_git ) ?,
8188 Self :: Man => Self :: man ( & project) ?,
8289 Self :: Diff => Self :: diff ( & project) ?,
8390 Self :: All { no_git } => Self :: all ( & project, no_git) ?,
@@ -91,7 +98,7 @@ impl Subcommand {
9198 }
9299 Self :: completion_scripts ( & project) ?;
93100 Self :: readme ( & project) ?;
94- Self :: book ( & project) ?;
101+ Self :: book ( & project, no_git ) ?;
95102 Self :: man ( & project) ?;
96103 }
97104
@@ -188,7 +195,7 @@ impl Subcommand {
188195 }
189196
190197 #[ throws]
191- pub ( crate ) fn book ( project : & Project ) {
198+ pub ( crate ) fn book ( project : & Project , no_git : bool ) {
192199 info ! ( "Generating book…" ) ;
193200
194201 let gen = project. gen ( ) ?;
@@ -221,14 +228,17 @@ impl Subcommand {
221228
222229 Faq :: new ( & project. config . faq ) . render_to ( out. join ( "faq.md" ) ) ?;
223230
224- Summary :: new ( project) . render_to ( out. join ( "SUMMARY.md" ) ) ?;
225-
226231 Introduction :: new ( & project. config ) . render_to ( out. join ( "introduction.md" ) ) ?;
227232
228- let changelog = Changelog :: new ( & project) ?;
233+ let include_changelog = !no_git;
234+
235+ Summary :: new ( project, include_changelog) . render_to ( out. join ( "SUMMARY.md" ) ) ?;
229236
230- let dst = out. join ( "changelog.md" ) ;
231- fs:: write ( & dst, changelog. render ( true ) ?) . context ( error:: Filesystem { path : dst } ) ?;
237+ if !no_git {
238+ let changelog = Changelog :: new ( & project) ?;
239+ let dst = out. join ( "changelog.md" ) ;
240+ fs:: write ( & dst, changelog. render ( true ) ?) . context ( error:: Filesystem { path : dst } ) ?;
241+ }
232242 }
233243
234244 #[ throws]
0 commit comments