Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ Then, add `openapi-tui` to your `configuration.nix`
| `↓`, `j` | Move down in lists |
| `↑`, `k` | Move up in lists |
| `1...9` | Move between tabs |
| `]` | Move to next tab |
| `[` | Move to previous tab |
| `f` | Toggle fullscreen pane|
| `g` | Go in nested items in lists|
| `/` | Filter apis|
Expand Down
2 changes: 2 additions & 0 deletions src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pub enum Action {
Submit,
Update,
Tab(u32),
TabNext,
TabPrev,
Go,
Back,
ToggleFullScreen,
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ impl Page for Home {
KeyCode::Char(c) if ('1'..='9').contains(&c) => {
EventResponse::Stop(Action::Tab(c.to_digit(10).unwrap_or(0) - 1))
},
KeyCode::Char(']') => EventResponse::Stop(Action::TabNext),
KeyCode::Char('[') => EventResponse::Stop(Action::TabPrev),
KeyCode::Char('/') => EventResponse::Stop(Action::FocusFooter),
_ => {
return Ok(None);
Expand Down
9 changes: 9 additions & 0 deletions src/panes/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ impl Pane for RequestPane {
self.schemas_index = index.try_into()?;
self.init_schema()?;
},
Action::TabNext => {
let next_tab_index = self.schemas_index + 1;
self.schemas_index = if next_tab_index < self.schemas.len() { next_tab_index } else { 0 };
self.init_schema()?;
},
Action::TabPrev => {
self.schemas_index = if self.schemas_index > 0 { self.schemas_index - 1 } else { self.schemas.len() - 1 };
self.init_schema()?;
},
Action::Go => self.schema_viewer.go()?,
Action::Back => {
if let Some(request_type) = self.schemas.get(self.schemas_index) {
Expand Down
9 changes: 9 additions & 0 deletions src/panes/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ impl Pane for ResponsePane {
self.schemas_index = index.try_into()?;
self.init_schema()?;
},
Action::TabNext => {
let next_tab_index = self.schemas_index + 1;
self.schemas_index = if next_tab_index < self.schemas.len() { next_tab_index } else { 0 };
self.init_schema()?;
},
Action::TabPrev => {
self.schemas_index = if self.schemas_index > 0 { self.schemas_index - 1 } else { self.schemas.len() - 1 };
self.init_schema()?;
},
Action::Go => self.schema_viewer.go()?,
Action::Back => {
if let Some(response_type) = self.schemas.get(self.schemas_index) {
Expand Down