Skip to content

Commit

Permalink
Merge pull request #270 from jvanbuel/feature/open-browser
Browse files Browse the repository at this point in the history
feat: open browser to endpoint when pressing 'o'
  • Loading branch information
jvanbuel authored Dec 5, 2024
2 parents e27eb37 + 822b094 commit 93ad52d
Show file tree
Hide file tree
Showing 3 changed files with 200 additions and 2 deletions.
195 changes: 193 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ time = { version = "0.3.36", features = [
tokio = { version = "1.41.1", features = ["full"] }
toml = "0.8.19"
url = "2.5.4"
webbrowser = "1.0.3"

[dev-dependencies]
mockito = "1.5.0"
Expand Down
6 changes: 6 additions & 0 deletions src/app/model/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ impl Model for ConfigModel {
KeyCode::Char('/') => {
self.filter.toggle();
}
KeyCode::Char('o') => {
let selected_config = self.filtered.state.selected().unwrap_or_default();
let endpoint = &self.filtered.items[selected_config].endpoint;
debug!("Selected config: {}", endpoint);
webbrowser::open(endpoint).unwrap();
}
KeyCode::Enter => {
let selected_config = self.filtered.state.selected().unwrap_or_default();
debug!(
Expand Down

0 comments on commit 93ad52d

Please sign in to comment.