Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

Commit

Permalink
feat: implement command echo
Browse files Browse the repository at this point in the history
  • Loading branch information
kauefraga committed Feb 22, 2024
1 parent f4b3c71 commit 516992e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main.rs
@@ -1,3 +1,21 @@
use std::env;

fn main() {
println!("Hello, world!");
let mut args: Vec<String> = env::args().collect();

/*
* Read the `remove` docstring.
* This `remove(0)` is the worst case,
* all the arguments are going to be
* shifted to the left, everytime.
*/
args.remove(0);

let mut output = String::new();

for arg in args {
output.push_str(&format!("{arg} "));
}

println!("{}", output.trim());
}

0 comments on commit 516992e

Please sign in to comment.