diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main.rs b/src/main.rs index e6e36d9..b42d73c 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,19 +1,16 @@ | |||
1 | #![warn(clippy::all)] | 1 | #![warn(clippy::all)] |
2 | 2 | ||
3 | //mod doxygen; | ||
4 | mod cli; | 3 | mod cli; |
5 | mod config; | 4 | mod config; |
6 | mod entities; | ||
7 | mod generator; | 5 | mod generator; |
8 | mod pandoc; | ||
9 | mod parsing; | 6 | mod parsing; |
7 | mod types; | ||
10 | 8 | ||
11 | #[macro_use] | 9 | #[macro_use] |
12 | extern crate log; | 10 | extern crate log; |
13 | 11 | ||
14 | use cli::{Command, ConfigCommand}; | 12 | use cli::{Command, ConfigCommand}; |
15 | use generator::generate; | 13 | use generator::generate; |
16 | use parsing::parse_file; | ||
17 | 14 | ||
18 | use anyhow::{Context, Result}; | 15 | use anyhow::{Context, Result}; |
19 | use codemap::CodeMap; | 16 | use codemap::CodeMap; |
@@ -86,14 +83,15 @@ fn start(codemap: &mut CodeMap) -> Result<()> { | |||
86 | .with_context(|| format!("Cannot change current directory to: {:?}", cli.directory))?; | 83 | .with_context(|| format!("Cannot change current directory to: {:?}", cli.directory))?; |
87 | 84 | ||
88 | match &cli.command { | 85 | match &cli.command { |
89 | Command::Generate { file } => { | 86 | Command::Generate { file: _ } => { |
90 | let file = file.clone(); | 87 | //let file = file.clone(); |
91 | let config = load_effective_config(cli, codemap)?; | 88 | let config = load_effective_config(cli, codemap)?; |
92 | 89 | ||
93 | let manager = parse_file(file, &config.extra_clang_args); | 90 | let entities = parsing::clang::parse_compile_commands(&config.clang, codemap)?; |
91 | //let manager = parse_file(file, &config.extra_clang_args); | ||
94 | 92 | ||
95 | let base_output_dir = std::path::Path::new("doc"); | 93 | let base_output_dir = std::path::Path::new("doc"); |
96 | generate(&base_output_dir, manager, &config)?; | 94 | generate(&base_output_dir, entities, &config.generator)?; |
97 | } | 95 | } |
98 | Command::Config { | 96 | Command::Config { |
99 | command: ConfigCommand::Default, | 97 | command: ConfigCommand::Default, |
@@ -105,7 +103,7 @@ fn start(codemap: &mut CodeMap) -> Result<()> { | |||
105 | } => { | 103 | } => { |
106 | print!( | 104 | print!( |
107 | "{}", | 105 | "{}", |
108 | toml::to_string_pretty(&config::load_config(".", codemap)?)? | 106 | toml::to_string_pretty(&load_effective_config(cli, codemap)?)? |
109 | ); | 107 | ); |
110 | } | 108 | } |
111 | } | 109 | } |
@@ -114,5 +112,6 @@ fn start(codemap: &mut CodeMap) -> Result<()> { | |||
114 | } | 112 | } |
115 | 113 | ||
116 | fn load_effective_config(cli: cli::Cli, codemap: &mut CodeMap) -> Result<config::Config> { | 114 | fn load_effective_config(cli: cli::Cli, codemap: &mut CodeMap) -> Result<config::Config> { |
117 | Ok(config::load_config(".", codemap)?.merge_cli(cli)) | 115 | let conf_file_conf = config::load_config(".", codemap)?; |
116 | Ok(config::Config::from_merge(cli, conf_file_conf)?) | ||
118 | } | 117 | } |