Skip to content

Commit 13d6879

Browse files
authored
Merge pull request #494 from sanders41/docs
Add option to include docs
2 parents 28d99aa + a5a54a6 commit 13d6879

File tree

28 files changed

+728
-66
lines changed

28 files changed

+728
-66
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ Dev packages:
3434
- [justfile](https://github.com/casey/just) for running commands (to use this you will need to
3535
install just)
3636

37+
## Docs
38+
39+
If you chose to include docs then additional dev packages will be included for docs.
40+
41+
- [mkdocs](index_md) for creating the docs
42+
- [mkdocs-material](index_md) for theming the docs
43+
- [mkdocstrings](index_md) for automatically creating API docs
44+
45+
Additionally the `pypi_publish.yml` workflow will also be setup to deploy the doc on release.
46+
3747
## Installation
3848

3949
Install with `cargo`:
@@ -152,6 +162,42 @@ python-project create -s
152162
Choosing yes will setup CI to run tests on Linux, Mac, and Windows. If no is chosen tests will
153163
only run on Linux in CI.
154164

165+
- Include Docs
166+
167+
Choosing yes will add additional packages and base setup for creating documents with mkdocs.
168+
169+
- Docs Site Name
170+
171+
This quesion will only show if you chose `yes` for `Include Docs`. This value sets the site name
172+
field for mkdocs.
173+
174+
- Docs Site Description
175+
176+
This quesion will only show if you chose `yes` for `Include Docs`. This value provides a
177+
a description of the repo to use in the docs.
178+
179+
- Docs Site URL
180+
181+
This quesion will only show if you chose `yes` for `Include Docs`. This is the URL where the docs
182+
will be hosted.
183+
184+
- Docs Locale
185+
186+
This quesion will only show if you chose `yes` for `Include Docs`, and controls the language of
187+
the docs.
188+
189+
- Repo Name
190+
191+
This quesion will only show if you chose `yes` for `Include Docs`. This is the name of the repo
192+
the docs are referencing. For example in this repository the repo name would be
193+
`sanders41/python-project-generator`.
194+
195+
- Repo URL
196+
197+
This quesion will only show if you chose `yes` for `Include Docs`. This is URL for the repo the
198+
docs are referencing. For example in this repository the repo url would be
199+
`https://github.com/sanders41/python-project-generator`
200+
155201
After running the generator a new directory will be created with the name you used for the
156202
`Project Slug`. Change to this directory then install the python packages and pre-commit hooks.
157203

src/cli.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ pub enum Param {
9999
/// Save a default value for Use Multi OS CI
100100
UseMultiOsCi { value: BooleanChoice },
101101

102+
/// Setup docs
103+
IncludeDocs { value: BooleanChoice },
104+
102105
/// Save a default value for Download Latest Packages
103106
DownloadLatestPackages { value: BooleanChoice },
104107

src/config.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub struct Config {
3030
pub use_continuous_deployment: Option<bool>,
3131
pub use_release_drafter: Option<bool>,
3232
pub use_multi_os_ci: Option<bool>,
33+
pub include_docs: Option<bool>,
3334
pub download_latest_packages: Option<bool>,
3435
}
3536

@@ -270,6 +271,17 @@ impl Config {
270271
Ok(())
271272
}
272273

274+
pub fn save_include_docs(value: bool) -> Result<()> {
275+
if let Ok(mut config) = Config::load_config() {
276+
config.include_docs = Some(value);
277+
config.save()?;
278+
} else {
279+
raise_error()?;
280+
}
281+
282+
Ok(())
283+
}
284+
273285
pub fn save_download_latest_packages(value: bool) -> Result<()> {
274286
if let Ok(mut config) = Config::load_config() {
275287
config.download_latest_packages = Some(value);
@@ -320,6 +332,7 @@ impl Config {
320332
);
321333
print_config_value("Use Release Drafter", &config.use_release_drafter);
322334
print_config_value("Use Multi OS CI", &config.use_multi_os_ci);
335+
print_config_value("Include Docs", &config.include_docs);
323336
print_config_value("Download Latest Packages", &config.download_latest_packages);
324337
}
325338
}

0 commit comments

Comments
 (0)