Add roc glue subcommand

This commit is contained in:
Richard Feldman 2022-07-24 09:39:48 -04:00
parent c5f04aaf73
commit e707084541
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798

View file

@ -43,6 +43,7 @@ pub const CMD_CHECK: &str = "check";
pub const CMD_VERSION: &str = "version";
pub const CMD_FORMAT: &str = "format";
pub const CMD_TEST: &str = "test";
pub const CMD_GLUE: &str = "glue";
pub const FLAG_DEBUG: &str = "debug";
pub const FLAG_DEV: &str = "dev";
@ -59,6 +60,7 @@ pub const FLAG_VALGRIND: &str = "valgrind";
pub const FLAG_CHECK: &str = "check";
pub const ROC_FILE: &str = "ROC_FILE";
pub const ROC_DIR: &str = "ROC_DIR";
pub const GLUE_FILE: &str = "GLUE_FILE";
pub const DIRECTORY_OR_FILES: &str = "DIRECTORY_OR_FILES";
pub const ARGS_FOR_APP: &str = "ARGS_FOR_APP";
@ -246,6 +248,21 @@ pub fn build_app<'a>() -> Command<'a> {
.allow_invalid_utf8(true)
)
)
.subcommand(Command::new(CMD_GLUE)
.about("Generate glue code between a platform's Roc API and its host language.")
.arg(
Arg::new(ROC_FILE)
.help("The .roc file for the platform module")
.allow_invalid_utf8(true)
.required(true)
)
.arg(
Arg::new(GLUE_FILE)
.help("The filename for the generated glue code. Currently, this must be a .rs file because only Rust glue generation is supported so far.")
.allow_invalid_utf8(true)
.required(true)
)
)
.trailing_var_arg(true)
.arg(flag_optimize)
.arg(flag_max_threads.clone())