Skip to content

Commit 6974fa2

Browse files
committed
Update help to explain use of - for standard input
1 parent dd13fbb commit 6974fa2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn main() {
7676
.arg(
7777
Arg::new("filename")
7878
.required(true)
79-
.help("The file containing the code for the Technique you want to type-check."),
79+
.help("The file containing the code for the Technique you want to parse and type check, or - to read from standard input."),
8080
),
8181
)
8282
.subcommand(
@@ -101,7 +101,7 @@ fn main() {
101101
.arg(
102102
Arg::new("filename")
103103
.required(true)
104-
.help("The file containing the code for the Technique you want to format."),
104+
.help("The file containing the code for the Technique you want to format, or - to read from standard input."),
105105
),
106106
)
107107
.subcommand(

src/rendering/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use owo_colors::OwoColorize;
12
use serde::Serialize;
23
use std::io::Write;
34
use std::path::Path;
@@ -25,6 +26,13 @@ pub(crate) fn via_typst(filename: &Path, markup: &str) {
2526
info!("Printing file: {}", filename.display());
2627

2728
// Verify that the file actually exists
29+
if filename.to_str() == Some("-") {
30+
eprintln!(
31+
"{}: Unable to render to PDF from standard input.",
32+
"error".bright_red()
33+
);
34+
std::process::exit(1);
35+
}
2836
if !filename.exists() {
2937
panic!(
3038
"Supplied procedure file does not exist: {}",

0 commit comments

Comments
 (0)