Skip to content

Commit 513b1cf

Browse files
committed
feat(cli): added support for cargo colors
1 parent e8f000d commit 513b1cf

File tree

9 files changed

+26
-8
lines changed

9 files changed

+26
-8
lines changed

packages/perseus-cli/src/build.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ pub fn build_internal(
9292
vec![
9393
("PERSEUS_ENGINE_OPERATION", "build"),
9494
("CARGO_TARGET_DIR", "dist/target_engine"),
95-
("RUSTFLAGS", "--cfg=engine")
95+
("RUSTFLAGS", "--cfg=engine"),
96+
("CARGO_TERM_COLOR", "always")
9697
]
9798
)?);
9899

@@ -137,11 +138,13 @@ pub fn build_internal(
137138
vec![
138139
("CARGO_TARGET_DIR", "dist/target_wasm"),
139140
("RUSTFLAGS", &wasm_release_rustflags),
141+
("CARGO_TERM_COLOR", "always"),
140142
]
141143
} else {
142144
vec![
143145
("CARGO_TARGET_DIR", "dist/target_wasm"),
144146
("RUSTFLAGS", "--cfg=client"),
147+
("CARGO_TERM_COLOR", "always"),
145148
]
146149
}
147150
)?);

packages/perseus-cli/src/check.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ fn cargo_check(
123123
// and the browser simultaneously (different targets, so no
124124
// commonalities gained by one directory)
125125
("CARGO_TARGET_DIR", "dist/target_engine"),
126-
("RUSTFLAGS", "--cfg=engine")
126+
("RUSTFLAGS", "--cfg=engine"),
127+
("CARGO_TERM_COLOR", "always")
127128
]
128129
)?);
129130

@@ -143,7 +144,8 @@ fn cargo_check(
143144
&browser_msg,
144145
vec![
145146
("CARGO_TARGET_DIR", "dist/target_wasm"),
146-
("RUSTFLAGS", "--cfg=client")
147+
("RUSTFLAGS", "--cfg=client"),
148+
("CARGO_TERM_COLOR", "always")
147149
]
148150
)?);
149151

@@ -185,7 +187,8 @@ fn run_static_generation(
185187
vec![
186188
("PERSEUS_ENGINE_OPERATION", "build"),
187189
("CARGO_TARGET_DIR", "dist/target_engine"),
188-
("RUSTFLAGS", "--cfg=engine")
190+
("RUSTFLAGS", "--cfg=engine"),
191+
("CARGO_TERM_COLOR", "always")
189192
]
190193
)?);
191194

packages/perseus-cli/src/cmd.rs

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub fn run_cmd(
3434
.args([shell_param, &cmd])
3535
.envs(envs)
3636
.current_dir(dir)
37+
// A pipe is set for stdio
3738
.output()
3839
.map_err(|err| ExecutionError::CmdExecFailed { cmd, source: err })?;
3940

packages/perseus-cli/src/export.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ pub fn export_internal(
203203
vec![
204204
("PERSEUS_ENGINE_OPERATION", "export"),
205205
("CARGO_TARGET_DIR", "dist/target_engine"),
206-
("RUSTFLAGS", "--cfg=engine")
206+
("RUSTFLAGS", "--cfg=engine"),
207+
("CARGO_TERM_COLOR", "always")
207208
]
208209
)?);
209210

@@ -248,11 +249,13 @@ pub fn export_internal(
248249
vec![
249250
("CARGO_TARGET_DIR", "dist/target_wasm"),
250251
("RUSTFLAGS", &wasm_release_rustflags),
252+
("CARGO_TERM_COLOR", "always"),
251253
]
252254
} else {
253255
vec![
254256
("CARGO_TARGET_DIR", "dist/target_wasm"),
255257
("RUSTFLAGS", "--cfg=client"),
258+
("CARGO_TERM_COLOR", "always"),
256259
]
257260
}
258261
)?);

packages/perseus-cli/src/export_error_page.rs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub fn export_error_page(
2828
("PERSEUS_ENGINE_OPERATION", "export_error_page"),
2929
("CARGO_TARGET_DIR", "dist/target_engine"),
3030
("RUSTFLAGS", "--cfg=engine"),
31+
("CARGO_TERM_COLOR", "always"),
3132
],
3233
|| {},
3334
)?;

packages/perseus-cli/src/install.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ impl Tools {
112112
&workspace_root,
113113
&lf_spinner,
114114
&lf_msg,
115-
vec![("RUSTFLAGS", "--cfg=engine")],
115+
vec![
116+
("RUSTFLAGS", "--cfg=engine"),
117+
("CARGO_TERM_COLOR", "always"),
118+
],
116119
)
117120
.map_err(|err| InstallError::LockfileGenerationFailed { source: err })?;
118121
if exit_code != 0 {

packages/perseus-cli/src/serve.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ fn build_server(
8585
&sb_msg,
8686
vec![
8787
("CARGO_TARGET_DIR", "dist/target_engine"),
88-
("RUSTFLAGS", "--cfg=engine")
88+
("RUSTFLAGS", "--cfg=engine"),
89+
("CARGO_TERM_COLOR", "always")
8990
]
9091
)?);
9192

packages/perseus-cli/src/snoop.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use crate::parse::{Opts, SnoopServeOpts};
44
use crate::{errors::*, get_user_crate_name};
55
use std::path::PathBuf;
66

7+
// NOTE: Cargo colors are left to the terminal directly here.
8+
79
/// Runs static generation processes directly so the user can see detailed logs.
810
/// This is commonly used for allowing users to see `dbg!` and the like in their
911
/// builder functions.

packages/perseus-cli/src/tinker.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ pub fn tinker_internal(
6363
vec![
6464
("PERSEUS_ENGINE_OPERATION", "tinker"),
6565
("CARGO_TARGET_DIR", "dist/target_engine"),
66-
("RUSTFLAGS", "--cfg=engine")
66+
("RUSTFLAGS", "--cfg=engine"),
67+
("CARGO_TERM_COLOR", "always")
6768
]
6869
)?);
6970

0 commit comments

Comments
 (0)