Remove test-bins feature.

This commit is contained in:
Andrés N. Robalino
2020-05-17 22:52:56 -05:00
parent d1b1438ce5
commit f18424a6f6
13 changed files with 134 additions and 126 deletions

View File

@ -1,47 +0,0 @@
use std::io::{self, BufRead, Write};
fn main() {
if did_chop_arguments() {
// we are done and don't care about standard input.
std::process::exit(0);
}
// if no arguments given, chop from standard input and exit.
let stdin = io::stdin();
let mut stdout = io::stdout();
for line in stdin.lock().lines() {
if let Ok(given) = line {
if let Err(_e) = writeln!(stdout, "{}", chop(&given)) {
break;
}
}
}
std::process::exit(0);
}
fn chop(word: &str) -> &str {
if word.is_empty() {
word
} else {
let to = word.len() - 1;
&word[..to]
}
}
fn did_chop_arguments() -> bool {
let args: Vec<String> = std::env::args().collect();
if args.len() > 1 {
let mut arguments = args.iter();
arguments.next();
for arg in arguments {
println!("{}", chop(arg));
}
return true;
}
false
}

View File

@ -1,17 +0,0 @@
fn main() {
let args: Vec<String> = std::env::args().collect();
if args.len() > 1 {
// Write back out all the arguments passed
// if given at least 1 instead of chickens
// speaking co co co.
let mut arguments = args.iter();
arguments.next();
for arg in arguments {
println!("{}", &arg);
}
} else {
println!("cococo");
}
}

View File

@ -1,3 +0,0 @@
fn main() {
std::process::exit(1);
}

View File

@ -1,13 +0,0 @@
use std::io::{self, Write};
fn main() {
let args: Vec<String> = std::env::args().collect();
// println! panics if stdout gets closed, whereas writeln gives us an error
let mut stdout = io::stdout();
let _ = args
.iter()
.skip(1)
.cycle()
.try_for_each(|v| writeln!(stdout, "{}", v));
}

View File

@ -1,3 +0,0 @@
fn main() {
std::env::args().skip(1).for_each(|arg| print!("{}", arg));
}