diff options
Diffstat (limited to 'pkgs/by-name/ts/tskm/src/interface/open')
| -rw-r--r-- | pkgs/by-name/ts/tskm/src/interface/open/handle.rs | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/pkgs/by-name/ts/tskm/src/interface/open/handle.rs b/pkgs/by-name/ts/tskm/src/interface/open/handle.rs index 15f749c5..5b9100bc 100644 --- a/pkgs/by-name/ts/tskm/src/interface/open/handle.rs +++ b/pkgs/by-name/ts/tskm/src/interface/open/handle.rs @@ -10,7 +10,7 @@ use std::str::FromStr; -use anyhow::{Context, Result, bail}; +use anyhow::{bail, Context, Result}; use log::{error, info}; use url::Url; @@ -31,7 +31,7 @@ fn is_empty(project: &task::Project) -> Result<bool> { } #[allow(clippy::too_many_lines)] -pub fn handle(command: OpenCommand, state: &mut State) -> Result<()> { +pub async fn handle(command: OpenCommand, state: &mut State) -> Result<()> { match command { OpenCommand::Review { non_empty } => { for project in task::Project::all().context("Failed to get all project files")? { @@ -43,12 +43,14 @@ pub fn handle(command: OpenCommand, state: &mut State) -> Result<()> { project.to_project_display(), if is_empty { "is empty" } else { "is not empty" } ); - open_in_browser(project, state, None::<Vec<Url>>).with_context(|| { - format!( - "Failed to open project ('{}') in qutebrowser", - project.to_project_display() - ) - })?; + open_in_browser(project, state, None::<Vec<Url>>) + .await + .with_context(|| { + format!( + "Failed to open project ('{}') in qutebrowser", + project.to_project_display() + ) + })?; if project.is_touched() { project.untouch().with_context(|| { @@ -63,9 +65,11 @@ pub fn handle(command: OpenCommand, state: &mut State) -> Result<()> { } OpenCommand::Project { project, urls } => { project.touch().context("Failed to touch project")?; - open_in_browser(&project, state, urls).with_context(|| { - format!("Failed to open project: {}", project.to_project_display()) - })?; + open_in_browser(&project, state, urls) + .await + .with_context(|| { + format!("Failed to open project: {}", project.to_project_display()) + })?; } OpenCommand::Select { urls } => { let selected_project: task::Project = task::Project::from_project_string( @@ -85,7 +89,9 @@ pub fn handle(command: OpenCommand, state: &mut State) -> Result<()> { .touch() .context("Failed to touch project")?; - open_in_browser(&selected_project, state, urls).context("Failed to open project")?; + open_in_browser(&selected_project, state, urls) + .await + .context("Failed to open project")?; } OpenCommand::ListTabs { projects, mode } => { let projects = { @@ -152,7 +158,13 @@ pub fn handle(command: OpenCommand, state: &mut State) -> Result<()> { }; for (active, url) in tabs { - let is_selected = { if active { "🔻 " } else { " " } }; + let is_selected = { + if active { + "🔻 " + } else { + " " + } + }; println!("{is_selected}{url}"); } } |
