Have the roc CLI use the new glue

This commit is contained in:
Richard Feldman 2022-07-24 10:41:05 -04:00
parent 7258446283
commit 4bc961a453
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
3 changed files with 68 additions and 6 deletions

View file

@ -65,7 +65,16 @@ fn main() -> io::Result<()> {
}
}
Some((CMD_GLUE, matches)) => {
todo!("GLUE!");
let input_path: &Path = matches.get_one(ROC_FILE).unwrap();
let output_path: &Path = matches.get_one(GLUE_FILE).unwrap();
if Some("rs") == output_path.extension().and_then(OsStr::to_str) {
glue::load(input_path, output_path)
} else {
eprintln!("Currently, `roc glue` only supports generating Rust glue files (with the .rs extension). In the future, the plan is to decouple `roc glue` from any particular output format, by having it accept a second .roc file which gets executed as a plugin to generate glue code for any desired language. However, this has not yet been implemented, and for now only .rs is supported.");
Ok(1)
}
}
Some((CMD_BUILD, matches)) => {
let target: Target = *matches.get_one(FLAG_TARGET).unwrap();