From f34081ea8b77cd0e99e02e5f768cb96209e52b5c Mon Sep 17 00:00:00 2001 From: GuilhermeWerner Date: Mon, 18 Jan 2021 20:24:23 -0300 Subject: [PATCH] Create Sample Rust CLI App --- Cargo.toml | 13 +++++++++++++ Source/Console.rs | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Cargo.toml create mode 100644 Source/Console.rs diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0b85a8f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "RustCLI" +version = "0.0.1" +description = "Rust CLI" +repository = "https://github.com/GuilhermeWerner/RustCLI" +authors = ["GuilhermeWerner "] +license = "MIT" +edition = "2018" +publish = false + +[[bin]] +name="Console" +path = "Source/Console.rs" diff --git a/Source/Console.rs b/Source/Console.rs new file mode 100644 index 0000000..e3798f0 --- /dev/null +++ b/Source/Console.rs @@ -0,0 +1,20 @@ +// Copyright (c) TribuFu 2015-2020. All Rights Reserved + +#![allow(non_snake_case)] + +use std::io::{self, Read}; + +fn main() { + println!("Hello World"); + + loop { + let mut input = String::new(); + + match io::stdin().read_line(&mut input) { + Ok(n) => { + print!("{}", input); + } + Err(error) => panic!("{}", error), + } + } +}