From 2dd8d817bb931e988fb928c9ff31f3c2e5afd648 Mon Sep 17 00:00:00 2001 From: Brooks J Rady Date: Wed, 14 Apr 2021 16:36:02 +0100 Subject: [PATCH] feat(build): allow arguments to be passed to Zellij --- Makefile.toml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index a4388ebcb..e0c636ff4 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -88,15 +88,26 @@ fn patch_plugins(root: &str, part: Yaml) -> Yaml { [tasks.pre-launch] script_runner = "@duckscript" script = ''' -if is_empty ${CARGO_MAKE_TASK_ARGS} - set_env CARGO_MAKE_TASK_ARGS default +args = split ${CARGO_MAKE_TASK_ARGS} ; +set_env ZELLIJ_LAYOUT default + +if not array_is_empty ${args} + first = array_get ${args} 0 + if starts_with ${first} - + set_env ZELLIJ_ARGS ${CARGO_MAKE_TASK_ARGS} + else + set_env ZELLIJ_LAYOUT ${first} + array_remove ${args} 0 + args = array_join ${args} ; + set_env ZELLIJ_ARGS ${args} + end end ''' [tasks.launch] dependencies = ["pre-launch"] command = "cargo" -args = ["run", "--", "-l", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${CARGO_MAKE_TASK_ARGS}.yaml"] +args = ["run", "--", "-l", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${ZELLIJ_LAYOUT}.yaml", "@@split(ZELLIJ_ARGS,;)"] # Simple clippy tweak [tasks.clippy]