Skip to content

Commit aa7f2e9

Browse files
goat taxon/assembly search/count get -U flag to print the GoaT URL to the terminal window.
1 parent b127c63 commit aa7f2e9

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

src/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ async fn main() -> Result<()> {
240240
.long("url")
241241
.help("Print the underlying GoaT API URL(s). Useful for debugging."),
242242
)
243+
.arg(
244+
Arg::new("goat-ui-url")
245+
.short('U')
246+
.long("goat-ui-url")
247+
.help("Print the underlying GoaT UI URL(s). View on the browser!"),
248+
)
243249
};
244250

245251
let assembly_search_and_count = |name, about| {
@@ -377,6 +383,12 @@ async fn main() -> Result<()> {
377383
.long("url")
378384
.help("Print the underlying GoaT API URL(s). Useful for debugging."),
379385
)
386+
.arg(
387+
Arg::new("goat-ui-url")
388+
.short('U')
389+
.long("goat-ui-url")
390+
.help("Print the underlying GoaT UI URL(s). View on the browser!"),
391+
)
380392
};
381393

382394
// actually parse the matches.

src/report/report.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ pub struct Report {
1818
pub search: Vec<String>,
1919
/// The rank of the return type.
2020
pub rank: String,
21-
///
22-
pub url: bool,
2321
}
2422

2523
impl Report {
@@ -28,7 +26,6 @@ impl Report {
2826
// simply return the populated struct
2927
// taxon, url, rank
3028
let search_op = matches.value_of("taxon");
31-
let url = matches.is_present("url");
3229
// safe to unwrap, as default is defined.
3330
let rank = matches.value_of("rank").unwrap().to_string();
3431

@@ -38,7 +35,7 @@ impl Report {
3835
None => bail!("There was no taxon input."),
3936
};
4037

41-
Ok(Self { search, rank, url })
38+
Ok(Self { search, rank })
4239
}
4340

4441
/// Make the URL. Currently only [`RecordType::Newick`] supported.

src/utils/cli_matches.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub fn process_cli_args(
3434
) -> Result<(u64, Vec<String>, Vec<String>)> {
3535
// command line args same between taxon/assembly
3636
let print_url = matches.is_present("url");
37+
let print_goat_ui_url = matches.is_present("goat-ui-url");
3738
let tax_tree_enum = match matches.is_present("descendents") {
3839
true => TaxType::Tree,
3940
false => TaxType::Name,
@@ -221,6 +222,13 @@ pub fn process_cli_args(
221222
println!("{}.\tGoaT API URL: {}", index, url);
222223
}
223224
std::process::exit(0);
225+
} else if print_goat_ui_url {
226+
for (index, url) in url_vector_api.iter().enumerate() {
227+
// remove api/v2/
228+
let new_url = url.replace("api/v2/", "");
229+
println!("{}.\tGoaT API URL: {}", index, new_url);
230+
}
231+
std::process::exit(0);
224232
}
225233

226234
// return the url vector

0 commit comments

Comments
 (0)