summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorMinijackson <minijackson@riseup.net>2020-01-12 13:28:40 +0100
committerMinijackson <minijackson@riseup.net>2020-01-12 13:28:40 +0100
commit5d6f163000bf34d12ec9587b2d8572319d27607d (patch)
treeb6044c5c3a1e7f512404e2607ebc2ddbd4c89923 /src/main.rs
parent19a0d9c2724695c9e05fe0b85bbbdf03ebeeec5b (diff)
downloadposeidoc-5d6f163000bf34d12ec9587b2d8572319d27607d.tar.gz
poseidoc-5d6f163000bf34d12ec9587b2d8572319d27607d.zip
clang: allow parse single file + parse typedefs
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs21
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
3mod cli; 4mod 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 {