Skip to content

Commit

Permalink
feat: Add cli flags to sort perpherals by name
Browse files Browse the repository at this point in the history
  • Loading branch information
dzamlo committed Nov 23, 2023
1 parent c1e73e4 commit 9dc7635
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/cli_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,8 @@ pub struct Args {
/// ```
#[clap(long, value_parser = clap::builder::ValueParser::new(parse_name_map))]
pub names_map_file: Option<HashMap<uuid::Uuid, String>>,

/// Sort peripherals by name
#[clap(long)]
pub sort_by_name: bool,
}
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl Ctx {
#[tokio::main]
async fn main() {
let args = Args::parse();
let sort_by_name = args.sort_by_name;
let ctx = Arc::new(Ctx {
args,
latest_scan: RwLock::new(None),
Expand All @@ -47,7 +48,7 @@ async fn main() {
.expect("Can not establish BLE connection."),
request_scan_restart: Mutex::new(false),
global_error: Mutex::new(None),
sort_by_name: Mutex::new(false),
sort_by_name: Mutex::new(sort_by_name),
});

let ctx_clone = Arc::clone(&ctx);
Expand Down

0 comments on commit 9dc7635

Please sign in to comment.