diff --git a/components/hab/src/cli.rs b/components/hab/src/cli.rs index 10050f4b30..e76c864206 100644 --- a/components/hab/src/cli.rs +++ b/components/hab/src/cli.rs @@ -577,6 +577,7 @@ pub fn get() -> App<'static, 'static> { (@arg MOCK_DATA: -m --("mock-data") +takes_value "Path to json file with mock data for template, defaults to none") (@arg PRINT: -p --("print") "Prints config to STDOUT") (@arg RENDER_DIR: -r --("render-dir") +takes_value "Path to render templates to, defaults to ./results/") + (@arg NO_WRITE_FILE: -n --("no-render") --("no-render-dir") "Don't write anything to disk, ignores --render-dir") ) ) (@subcommand ring => diff --git a/components/hab/src/command/plan/render.rs b/components/hab/src/command/plan/render.rs index e8a1f3417e..f3df0f356b 100644 --- a/components/hab/src/command/plan/render.rs +++ b/components/hab/src/command/plan/render.rs @@ -30,6 +30,7 @@ pub fn start( user_toml_path: Option, mock_data_path: Option, print: bool, + no_render_dir: bool, render_dir: String, ) -> Result<()> { // Strip the file name out of our passed template @@ -102,8 +103,11 @@ pub fn start( ui.warn(format!("========### End rendered template: {}", &template_path))?; } - // Render our template file - create_with_template(ui, &format!("{}/{}", render_dir, file_name), &rendered_template)?; + if !(no_render_dir) { + // Render our template file + create_with_template(ui, &format!("{}/{}", render_dir, file_name), &rendered_template)?; + } + ui.br()?; // not really sure this is correct... Ok(()) diff --git a/components/hab/src/main.rs b/components/hab/src/main.rs index 7da8bf91c0..a7b69744d8 100644 --- a/components/hab/src/main.rs +++ b/components/hab/src/main.rs @@ -676,6 +676,7 @@ fn sub_plan_render(ui: &mut UI, m: &ArgMatches<'_>) -> Result<()> { }; let print = m.is_present("PRINT"); + let no_render_dir = m.is_present("NO_WRITE_FILE"); let render_dir = match m.value_of("RENDER_DIR") { Some(name) => name.to_string(), @@ -689,6 +690,7 @@ fn sub_plan_render(ui: &mut UI, m: &ArgMatches<'_>) -> Result<()> { user_toml_path, mock_data_path, print, + no_render_dir, render_dir, ) }