Skip to content

Commit d93a140

Browse files
committed
Get search paths from clap
1 parent 5046ffd commit d93a140

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ use std::collections::HashMap;
33
use std::fs;
44
use std::path::{Path, PathBuf};
55

6-
pub fn run(paths: &[String]) {
6+
pub fn run(paths: &[&str]) {
77
let blob_paths = find_blobs_in_paths(&paths);
88
let blobs_to_dependencies = get_dependencies(&blob_paths);
99
let missing_blobs = identify_missing(&blobs_to_dependencies);
1010
display_missing_blobs(&missing_blobs);
1111
}
1212

13-
fn find_blobs_in_paths(paths: &[String]) -> Vec<PathBuf> {
13+
fn find_blobs_in_paths(paths: &[&str]) -> Vec<PathBuf> {
1414
let dirs = paths
1515
.iter()
1616
.map(Path::new)

src/main.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
use std::env;
2-
31
use aosp_missing_blobs::run;
4-
use clap::App;
2+
use clap::{App, Arg};
53

64
fn main() {
7-
App::new("aosp-missing-blobs")
5+
let matches = App::new("aosp-missing-blobs")
86
.version("0.3.0")
97
.author("Josh Choo <dev@joshuous.com>")
108
.about("An AOSP tool to generate a list of required missing blobs.")
9+
.arg(
10+
Arg::with_name("PATHS")
11+
.help("Paths to blobs")
12+
.required(true)
13+
.multiple(true),
14+
)
1115
.get_matches();
1216

13-
let args: Vec<String> = env::args().collect();
14-
let paths = &args[1..];
17+
let paths = matches.values_of("PATHS").unwrap().collect::<Vec<_>>();
1518

16-
run(paths);
19+
run(&paths);
1720
}

0 commit comments

Comments
 (0)