diff options
author | Griffin Smith <root@gws.fyi> | 2021-03-07T20·29-0500 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2021-03-07T20·29-0500 |
commit | 80f8ede0bbc9799d5199707e1e1ad8e80e4ca7ac (patch) | |
tree | cbb418b042583714fe09f946f1b9a03d1d98857f /src/commands/compile.rs |
Initial commit
Diffstat (limited to 'src/commands/compile.rs')
-rw-r--r-- | src/commands/compile.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/commands/compile.rs b/src/commands/compile.rs new file mode 100644 index 000000000000..e16b8c87a659 --- /dev/null +++ b/src/commands/compile.rs @@ -0,0 +1,28 @@ +use std::path::PathBuf; + +use clap::Clap; + +use crate::common::Result; +use crate::compiler::{self, CompilerOptions}; + +#[derive(Clap)] +pub struct Compile { + file: PathBuf, + + #[clap(short = 'o')] + out_file: PathBuf, + + #[clap(flatten)] + options: CompilerOptions, +} + +impl Compile { + pub fn run(self) -> Result<()> { + eprintln!( + ">>> {} -> {}", + &self.file.to_string_lossy(), + self.out_file.to_string_lossy() + ); + compiler::compile_file(&self.file, &self.out_file, &self.options) + } +} |