Skip to content

Commit 892b4e7

Browse files
SuperCuberSuperCuber
andauthored
Add OS variables (#202)
* Insert os variables * Fmt * Add watch tracing --------- Co-authored-by: SuperCuber <[email protected]>
1 parent 6a526a8 commit 892b4e7

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/handlebars_helpers.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,16 @@ fn add_dotter_variable(
330330
"os".into(),
331331
(if cfg!(windows) { "windows" } else { "unix" }).into(),
332332
);
333+
334+
// New better way
335+
dotter.insert("unix".into(), Value::Boolean(cfg!(unix)));
336+
dotter.insert(
337+
"windows".into(),
338+
Value::Boolean(cfg!(target_os = "windows")),
339+
);
340+
dotter.insert("linux".into(), Value::Boolean(cfg!(target_os = "linux")));
341+
dotter.insert("macos".into(), Value::Boolean(cfg!(target_os = "macos")));
342+
333343
dotter.insert(
334344
"current_dir".into(),
335345
Value::String(

src/watch.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ pub(crate) async fn watch(opt: Options) -> Result<()> {
5656
return action;
5757
}
5858

59+
debug!("Changes detected in watched files.");
60+
trace!("Changed files: {:#?}", action.paths().collect::<Vec<_>>());
61+
5962
println!("[Dotter] Deploying...");
6063
if let Err(e) = deploy::deploy(&opt) {
6164
display_error(e);

0 commit comments

Comments
 (0)