Skip to content

Commit

Permalink
chore: cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
LoricAndre committed Dec 1, 2024
1 parent 04541d5 commit 621fa1e
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions skim/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,22 @@ fn sk_main() -> Result<i32, SkMainError> {
//------------------------------------------------------------------------------
// output

let Some(result) = (
if opts.tmux.is_some() {
crate::tmux::run_with(&opts)
let Some(result) = (if opts.tmux.is_some() {
crate::tmux::run_with(&opts)
} else {
// read from pipe or command
let rx_item = if io::stdin().is_terminal() {
None
} else {
// read from pipe or command
let rx_item = if io::stdin().is_terminal() {
None
} else {
let rx_item = cmd_collector.borrow().of_bufread(BufReader::new(std::io::stdin()));
Some(rx_item)
};
// filter mode
if opts.filter.is_some() {
return Ok(filter(&bin_options, &opts, rx_item));
}
Skim::run_with(&opts, rx_item)
}) else {
let rx_item = cmd_collector.borrow().of_bufread(BufReader::new(std::io::stdin()));
Some(rx_item)
};
// filter mode
if opts.filter.is_some() {
return Ok(filter(&bin_options, &opts, rx_item));
}
Skim::run_with(&opts, rx_item)
}) else {
return Ok(135);
};

Expand Down Expand Up @@ -189,11 +188,7 @@ pub struct BinOptions {
print_cmd: bool,
}

pub fn filter(
bin_option: &BinOptions,
options: &SkimOptions,
source: Option<SkimItemReceiver>,
) -> i32 {
pub fn filter(bin_option: &BinOptions, options: &SkimOptions, source: Option<SkimItemReceiver>) -> i32 {
let default_command = match env::var("SKIM_DEFAULT_COMMAND").as_ref().map(String::as_ref) {
Ok("") | Err(_) => "find .".to_owned(),
Ok(val) => val.to_owned(),
Expand Down

0 comments on commit 621fa1e

Please sign in to comment.