trim whitespaces
This commit is contained in:
@@ -29,7 +29,7 @@ fn main() -> io::Result<()> {
|
||||
let buffer = std::str::from_utf8(&file_content.data)
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
|
||||
let first_choice: Vec<String> = buffer.lines().map(|line| line.to_string()).collect();
|
||||
let first_choice: Vec<String> = buffer.lines().map(|line| line.trim().to_string()).collect();
|
||||
|
||||
for (index, element) in first_choice.iter().enumerate() {
|
||||
eprint!("{}. {}\n", index + 1, element);
|
||||
@@ -103,7 +103,7 @@ fn install_programs() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let file = Asset::get("prompts/programs.txt").ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, "File not found"))?;
|
||||
let buffer = std::str::from_utf8(&file.data)
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
let choice: Vec<String> = buffer.lines().map(|line| line.to_string()).collect();
|
||||
let choice: Vec<String> = buffer.lines().map(|line| line.trim().to_string()).collect();
|
||||
|
||||
for(index, element) in choice.iter().enumerate() {
|
||||
eprint!("{}. {}\n", index+1, element)
|
||||
@@ -249,7 +249,7 @@ fn aur() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let file = Asset::get("prompts/aur.txt").ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, "File not found"))?;
|
||||
let buffer = std::str::from_utf8(&file.data)
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
let choice: Vec<String> = buffer.lines().map(|line| line.to_string()).collect();
|
||||
let choice: Vec<String> = buffer.lines().map(|line| line.trim().to_string()).collect();
|
||||
|
||||
if which("yay").is_none() {
|
||||
eprint!("yay not found. Install yay Y/N? (1/0)");
|
||||
@@ -295,7 +295,7 @@ fn third_party() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let buffer = std::str::from_utf8(&file.data)
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
|
||||
|
||||
let choices: Vec<String> = buffer.lines().map(|line| line.to_string()).collect();
|
||||
let choices: Vec<String> = buffer.lines().map(|line| line.trim().to_string()).collect();
|
||||
|
||||
for (index, element) in choices.iter().enumerate() {
|
||||
eprintln!("{}. {}", index + 1, element);
|
||||
|
||||
Reference in New Issue
Block a user