commit 6bebbac9cd22d3f16fce0cc27ba89cc74490eb0c
Author: Yash <nerdstep710@gmail.com>
Date: Wed, 3 Feb 2021 15:19:11 -0600
Initial commit
Diffstat:
5 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/Cargo.lock b/Cargo.lock
@@ -0,0 +1,5 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "sandwich"
+version = "0.1.0"
diff --git a/Cargo.toml b/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "sandwich"
+version = "0.1.0"
+authors = ["Yash <nerdstep710@gmail.com>"]
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/inp.txt b/inp.txt
@@ -0,0 +1 @@
+Test file
diff --git a/src/main.rs b/src/main.rs
@@ -0,0 +1,15 @@
+use std::fs;
+use std::env;
+
+fn main() {
+
+ let args: Vec<String> = env::args().collect();
+ if args.len() == 1 {
+ panic!("You must provide an argument!");
+ }
+
+ let filename = &args[1];
+
+ let contents = fs::read_to_string(filename).expect("Something went wrong reading the file");
+ println!("{}", contents);
+}