diff options
author | Minijackson <minijackson@riseup.net> | 2019-11-23 19:27:21 +0100 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2019-11-23 19:31:58 +0100 |
commit | 860b73f1644ecd6548ae403ec483625fb7b625ea (patch) | |
tree | 1e0ab5ecf2a77a66e2a176364ecb151a58468426 /src/main.rs | |
parent | 304d9f220cc208dd78fce11b703354ecd8d2168c (diff) | |
download | poseidoc-860b73f1644ecd6548ae403ec483625fb7b625ea.tar.gz poseidoc-860b73f1644ecd6548ae403ec483625fb7b625ea.zip |
entities rework, allow "inline" documentation, merge config with cli
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 503688e..e6e36d9 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | #![warn(clippy::all)] | ||
2 | |||
1 | //mod doxygen; | 3 | //mod doxygen; |
2 | mod cli; | 4 | mod cli; |
3 | mod config; | 5 | mod config; |
@@ -83,13 +85,15 @@ fn start(codemap: &mut CodeMap) -> Result<()> { | |||
83 | std::env::set_current_dir(&cli.directory) | 85 | std::env::set_current_dir(&cli.directory) |
84 | .with_context(|| format!("Cannot change current directory to: {:?}", cli.directory))?; | 86 | .with_context(|| format!("Cannot change current directory to: {:?}", cli.directory))?; |
85 | 87 | ||
86 | match cli.command { | 88 | match &cli.command { |
87 | Command::Generate { file } => { | 89 | Command::Generate { file } => { |
88 | let extra_args = cli.extra_arg.iter().flatten().map(AsRef::as_ref).collect(); | 90 | let file = file.clone(); |
89 | let manager = parse_file(file, extra_args); | 91 | let config = load_effective_config(cli, codemap)?; |
92 | |||
93 | let manager = parse_file(file, &config.extra_clang_args); | ||
90 | 94 | ||
91 | let base_output_dir = std::path::Path::new("doc"); | 95 | let base_output_dir = std::path::Path::new("doc"); |
92 | generate(&base_output_dir, manager)?; | 96 | generate(&base_output_dir, manager, &config)?; |
93 | } | 97 | } |
94 | Command::Config { | 98 | Command::Config { |
95 | command: ConfigCommand::Default, | 99 | command: ConfigCommand::Default, |
@@ -108,3 +112,7 @@ fn start(codemap: &mut CodeMap) -> Result<()> { | |||
108 | 112 | ||
109 | Ok(()) | 113 | Ok(()) |
110 | } | 114 | } |
115 | |||
116 | fn load_effective_config(cli: cli::Cli, codemap: &mut CodeMap) -> Result<config::Config> { | ||
117 | Ok(config::load_config(".", codemap)?.merge_cli(cli)) | ||
118 | } | ||