We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b90ed66 commit a5cfa9dCopy full SHA for a5cfa9d
1 file changed
src/main.rs
@@ -32,16 +32,7 @@ fn main() -> Result<()> {
32
match cli.command {
33
Command::Find { paths } => {
34
let paths = if paths.is_empty() {
35
- stdin()
36
- .lines()
37
- .filter_map(|line| {
38
- let line = line.ok()?;
39
- if line.is_empty() {
40
- return None;
41
- }
42
- Some(line.to_string())
43
- })
44
- .collect::<Vec<_>>()
+ paths_from_stdin()
45
} else {
46
paths
47
};
@@ -50,3 +41,16 @@ fn main() -> Result<()> {
50
}
51
52
+
+fn paths_from_stdin() -> Vec<String> {
+ stdin()
+ .lines()
48
+ .filter_map(|line| {
49
+ let line = line.ok()?.trim().to_string();
+ if line.is_empty() {
+ return None;
+ }
53
+ Some(line)
54
+ })
55
+ .collect::<Vec<_>>()
56
+}
0 commit comments