diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs index 5c613e0..5a0b175 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,3 +1,4 @@ | |||
1 | #![deny(unsafe_code)] | ||
1 | #![warn(clippy::all)] | 2 | #![warn(clippy::all)] |
2 | 3 | ||
3 | mod cli; | 4 | mod cli; |
@@ -83,19 +84,27 @@ fn start(codemap: &mut CodeMap) -> Result<()> { | |||
83 | .with_context(|| format!("Cannot change current directory to: {:?}", cli.directory))?; | 84 | .with_context(|| format!("Cannot change current directory to: {:?}", cli.directory))?; |
84 | 85 | ||
85 | match &cli.command { | 86 | match &cli.command { |
86 | Command::Generate { file: _ } => { | 87 | Command::Generate { file } => { |
87 | //let file = file.clone(); | 88 | let file = file.clone(); |
88 | let config = load_effective_config(cli, codemap)?; | 89 | let config = load_effective_config(cli, codemap)?; |
89 | 90 | ||
90 | let entities = parser::clang::parse_compile_commands(&config.clang, codemap)?; | 91 | let entities = if let Some(file) = file { |
91 | //let manager = parse_file(file, &config.extra_clang_args); | 92 | parser::clang::parse_file(file, &config.clang, codemap)? |
93 | } else { | ||
94 | parser::clang::parse_compile_commands(&config.clang, codemap)? | ||
95 | }; | ||
92 | 96 | ||
93 | let base_output_dir = std::path::Path::new("doc"); | 97 | let base_output_dir = std::path::Path::new("doc"); |
94 | generate(&base_output_dir, entities, &config.generator)?; | 98 | generate(&base_output_dir, entities, &config.generator)?; |
95 | } | 99 | } |
96 | Command::Inspect => { | 100 | Command::Inspect { file } => { |
101 | let file = file.clone(); | ||
97 | let config = load_effective_config(cli, codemap)?; | 102 | let config = load_effective_config(cli, codemap)?; |
98 | let entities = parser::clang::parse_compile_commands(&config.clang, codemap)?; | 103 | let entities = if let Some(file) = file { |
104 | parser::clang::parse_file(file, &config.clang, codemap)? | ||
105 | } else { | ||
106 | parser::clang::parse_compile_commands(&config.clang, codemap)? | ||
107 | }; | ||
99 | serde_json::to_writer_pretty(std::io::stdout().lock(), &entities)?; | 108 | serde_json::to_writer_pretty(std::io::stdout().lock(), &entities)?; |
100 | } | 109 | } |
101 | Command::Config { | 110 | Command::Config { |