summaryrefslogtreecommitdiff
path: root/src/bin/r2md-fence.rs
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2026-06-19 04:40:39 +0300
committerA Farzat <a@farzat.xyz>2026-06-19 04:43:02 +0300
commit18a33193000e996e08e9a5547afe62c0346c0e21 (patch)
tree9751ca0a24de86fdbcd00a7aaed95449701bef49 /src/bin/r2md-fence.rs
parentb1c8df99e5bc3bb6639540ae47c58f1b304715a2 (diff)
downloadrepo2markdown-18a33193000e996e08e9a5547afe62c0346c0e21.tar.gz
repo2markdown-18a33193000e996e08e9a5547afe62c0346c0e21.zip
Add the r2md-fence binary
To feed individual files without the extra boilerplate.
Diffstat (limited to 'src/bin/r2md-fence.rs')
-rw-r--r--src/bin/r2md-fence.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/bin/r2md-fence.rs b/src/bin/r2md-fence.rs
new file mode 100644
index 0000000..bfaf8d5
--- /dev/null
+++ b/src/bin/r2md-fence.rs
@@ -0,0 +1,21 @@
+use std::io;
+
+use clap::Parser;
+use repo2markdown::fence_wrapper::wrap_in_fence;
+
+#[derive(Debug, Parser)]
+#[command(version, about, long_about = None)]
+struct Cli {
+ /// Language tag to append to the opening markdown fence.
+ #[arg(long, short, default_value = "")]
+ language: String,
+}
+
+fn main() -> io::Result<()> {
+ let cli = Cli::parse();
+
+ let stdin = io::stdin();
+ let stdout = io::stdout();
+
+ wrap_in_fence(stdin.lock(), stdout.lock(), &cli.language)
+}