From 6bebbac9cd22d3f16fce0cc27ba89cc74490eb0c Mon Sep 17 00:00:00 2001 From: Yash Date: Wed, 3 Feb 2021 15:19:11 -0600 Subject: [PATCH] Initial commit --- .gitignore | 1 + Cargo.lock | 5 +++++ Cargo.toml | 9 +++++++++ inp.txt | 1 + src/main.rs | 15 +++++++++++++++ 5 files changed, 31 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 inp.txt create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..3a13cc0 --- /dev/null +++ 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 new file mode 100644 index 0000000..d99656e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "sandwich" +version = "0.1.0" +authors = ["Yash "] +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 new file mode 100644 index 0000000..524acff --- /dev/null +++ b/inp.txt @@ -0,0 +1 @@ +Test file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..8b76e58 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,15 @@ +use std::fs; +use std::env; + +fn main() { + + let args: Vec = 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); +}