Skip to content

Commit db8f2ca

Browse files
committedNov 20, 2022
add version flag
1 parent fb9e14c commit db8f2ca

File tree

3 files changed

+395
-152
lines changed

3 files changed

+395
-152
lines changed
 

‎Cargo.lock

+383-146
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "leth"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
authors = ["fcd <femnad@users.noreply.github.com>"]
55
edition = "2018"
66

@@ -9,3 +9,4 @@ edition = "2018"
99
[dependencies]
1010
regex = "1"
1111
skim = "0.7.0"
12+
structopt = "0.3.26"

‎src/main.rs

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
extern crate regex;
22
extern crate skim;
3+
extern crate structopt;
34

45
use std::collections::HashMap;
56
use std::io::Cursor;
@@ -8,10 +9,17 @@ use std::process::Command;
89

910
use regex::Regex;
1011
use skim::{Skim, SkimOptionsBuilder};
12+
use structopt::StructOpt;
1113

1214
const URL_REGEX: &str = r"(http(s)?://[a-zA-Z0-9_/?+&.=@%#;~-]+)";
1315

16+
#[derive(Debug, StructOpt)]
17+
#[structopt(name = "leth", about = "URL extractor intended to be used within mutt")]
18+
struct Opt {}
19+
1420
pub fn main() {
21+
Opt::from_args();
22+
1523
let options = SkimOptionsBuilder::default()
1624
.multi(true)
1725
.bind(vec!["ctrl-k:kill-line"])
@@ -37,13 +45,10 @@ pub fn main() {
3745
}
3846
}
3947

40-
let mut ordered_items: Vec<_> = matches.into_iter()
41-
.collect();
48+
let mut ordered_items: Vec<_> = matches.into_iter().collect();
4249
ordered_items.sort_by(|a, b| a.1.cmp(&b.1));
4350

44-
let item_list: Vec<_> = ordered_items.iter()
45-
.map(|item|item.0)
46-
.collect();
51+
let item_list: Vec<_> = ordered_items.iter().map(|item| item.0).collect();
4752
let items = item_list.join("\n");
4853

4954
let selected_items = Skim::run_with(&options, Some(Box::new(Cursor::new(items))))

0 commit comments

Comments
 (0)
Please sign in to comment.