Skip to content

Commit

Permalink
chore(deps): update a range of dependencies (#117)
Browse files Browse the repository at this point in the history
ansi-to-tui : 6.0.0 => 7.0.0
bollard : 0.17.1 => 0.18.1
byte-unit : 5.1.4 => 5.1.6
clap : 4.5.20 => 4.5.21
ratatui : 0.28.1 => 0.29.0
ratatui-macros : 0.5.0 => 0.6.0
tracing : 0.1.40 => 0.1.41
tracing-error : 0.2.0 => 0.2.1
tracing-subscriber : 0.3.18 => 0.3.19
tui-big-text : 0.6.0 => 0.7.0
ureq :  2.10.1 => 2.11.0
  • Loading branch information
robertpsoane authored Dec 1, 2024
1 parent ace8d42 commit 0d45d5f
Show file tree
Hide file tree
Showing 13 changed files with 146 additions and 132 deletions.
174 changes: 104 additions & 70 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,36 @@ categories = ["command-line-utilities", "development-tools"]
include = ["/src", "LICENSE.txt", "CHANGELOG.md", "README.md"]

[dependencies]
ansi-to-tui = "6.0.0"
ansi-to-tui = "7.0.0"
async-trait = "0.1.83"
bollard = { version = "0.17.1", features = ["ssl"] }
byte-unit = { version = "5.1.4", features = ["byte"] }
bollard = { version = "0.18.1", features = ["ssl"] }
byte-unit = { version = "5.1.6", features = ["byte"] }
chrono = "0.4.38"
clap = { version = "4.5.20", features = ["derive"] }
clap = { version = "4.5.21", features = ["derive"] }
color-eyre = "0.6.3"
crossterm = { version = "0.28", features = ["event-stream"] }
dirs-next = "2.0.0"
dyn-clone = "1.0.17"
futures = "0.3.31"
itertools = "0.13.0"
lazy_static = "1.5.0"
ratatui = { version = "0.28.1", features = [
ratatui = { version = "0.29.0", features = [
"serde",
"unstable-rendered-line-info",
] }
ratatui-macros = "0.5.0"
ratatui-macros = "0.6.0"
serde = "1.0.215"
serde_yml = "0.0.12"
tokio = { version = "1.41.1", features = [
"rt-multi-thread",
"macros",
"process",
] }
tracing = "0.1.40"
tracing-error = "0.2.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
tui-big-text = "0.6.0"
ureq = { version = "2.10.1", features = ["json"] }
tracing = "0.1.41"
tracing-error = "0.2.1"
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
tui-big-text = "0.7.0"
ureq = { version = "2.11.0", features = ["json"] }


[profile.release]
Expand Down
8 changes: 4 additions & 4 deletions src/components/alert_modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use core::fmt;
use color_eyre::eyre::Result;

use ratatui::{
layout::{Alignment, Rect},
text::{Span, Text},
widgets::{block::Title, Paragraph, Wrap},
layout::Rect,
text::{Line, Span, Text},
widgets::{Paragraph, Wrap},
Frame,
};

Expand Down Expand Up @@ -73,7 +73,7 @@ where
_ => return,
};

let title = Title::from(format!("< {} >", self.title.clone())).alignment(Alignment::Center);
let title = Line::from(format!("< {} >", self.title.clone())).centered();

let message = Paragraph::new(Text::from(message))
.wrap(Wrap { trim: true })
Expand Down
8 changes: 4 additions & 4 deletions src/components/boolean_modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use itertools::Itertools;

use color_eyre::eyre::Result;
use ratatui::{
layout::{Alignment, Rect},
layout::Rect,
style::{Modifier, Style},
text::{Span, Text},
widgets::{block::Title, Paragraph, Wrap},
text::{Line, Span, Text},
widgets::{Paragraph, Wrap},
Frame,
};

Expand Down Expand Up @@ -89,7 +89,7 @@ where
_ => return,
};

let title = Title::from(format!("< {} >", self.title.clone())).alignment(Alignment::Center);
let title = Line::from(format!("< {} >", self.title.clone())).centered();

let message = Paragraph::new(Text::from(message))
.wrap(Wrap { trim: true })
Expand Down
5 changes: 2 additions & 3 deletions src/components/resize_notice.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use std::sync::Arc;

use ratatui::{
layout::{self},
style::Style,
text::{Line, Span, Text},
widgets::{block::Title, Block},
widgets::Block,
};
use ratatui_macros::{horizontal, vertical};

Expand Down Expand Up @@ -79,7 +78,7 @@ impl Component for ResizeScreen {
let info = Text::from(messages).alignment(ratatui::layout::Alignment::Center);

let block = Block::bordered()
.title(Title::from("< Terminal Too Small >").alignment(layout::Alignment::Center))
.title(Line::from("< Terminal Too Small >").centered())
.border_style(Style::default().fg(self.config.theme.negative_highlight()));

let [_, inner_area, _] = vertical![>=0, <=5, >=0].areas(area);
Expand Down
9 changes: 5 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ async fn main() -> color_eyre::Result<()> {
let docker = new_local_docker_connection(&config.docker_path)
.await
.context(format!("failed to create docker connection, potentially due to misconfiguration (see {CONFIGURATION_DOC_PATH})"))?;

terminal::init_panic_hook();

let mut terminal = terminal::init().context("failed to initialise terminal")?;
let mut terminal = ratatui::init();
terminal.clear()?;

let mut events = EventLoop::new();
let events_tx = events.get_tx();
Expand Down Expand Up @@ -83,7 +83,8 @@ async fn main() -> color_eyre::Result<()> {
}
Message::Transition(t) => {
if t == events::Transition::ToNewTerminal {
terminal = terminal::init().context("failed to initialise terminal")?;
terminal = ratatui::init();
terminal.clear()?;
} else {
let _ = &app.transition(t).await;
}
Expand All @@ -99,7 +100,7 @@ async fn main() -> color_eyre::Result<()> {
}
}

terminal::restore().context("failed to restore terminal")?;
ratatui::restore();

Ok(())
}
2 changes: 1 addition & 1 deletion src/pages/containers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ impl Component for Containers {

let table = Table::new(rows.clone(), widths)
.header(columns.clone().style(Style::new().bold()))
.highlight_style(Style::new().reversed());
.row_highlight_style(Style::new().reversed());

f.render_stateful_widget(table, area, &mut self.list_state);

Expand Down
2 changes: 1 addition & 1 deletion src/pages/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl Component for Images {

let table = Table::new(rows.clone(), widths)
.header(columns.clone().style(Style::new().bold()))
.highlight_style(Style::new().reversed());
.row_highlight_style(Style::new().reversed());

f.render_stateful_widget(table, area, &mut self.list_state);

Expand Down
2 changes: 1 addition & 1 deletion src/pages/networks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ impl Component for Network {

let table = Table::new(rows.clone(), widths)
.header(columns.clone().style(Style::new().bold()))
.highlight_style(Style::new().reversed());
.row_highlight_style(Style::new().reversed());

f.render_stateful_widget(table, area, &mut self.list_state);

Expand Down
2 changes: 1 addition & 1 deletion src/pages/volumes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl Component for Volume {

let table = Table::new(rows.clone(), widths)
.header(columns.clone().style(Style::new().bold()))
.highlight_style(Style::new().reversed());
.row_highlight_style(Style::new().reversed());

f.render_stateful_widget(table, area, &mut self.list_state);

Expand Down
25 changes: 2 additions & 23 deletions src/terminal.rs
Original file line number Diff line number Diff line change
@@ -1,31 +1,10 @@
use crossterm::{
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
ExecutableCommand,
};
use ratatui::prelude::*;
use std::{
io::stdout,
panic::{set_hook, take_hook},
};

pub fn init() -> std::io::Result<Terminal<impl Backend>> {
enable_raw_mode()?;
stdout().execute(EnterAlternateScreen)?;
let terminal = Terminal::new(CrosstermBackend::new(stdout()))?;
Ok(terminal)
}

pub fn restore() -> std::io::Result<()> {
stdout().execute(LeaveAlternateScreen)?;
disable_raw_mode()?;
Ok(())
}
use std::panic::{set_hook, take_hook};

pub fn init_panic_hook() {
let original_hook = take_hook();
set_hook(Box::new(move |panic_info| {
// intentionally ignore errors here since we're already in a panic
let _ = restore();
let _ = ratatui::restore();

Check warning on line 7 in src/terminal.rs

View workflow job for this annotation

GitHub Actions / check / stable / clippy

this let-binding has unit value

warning: this let-binding has unit value --> src/terminal.rs:7:9 | 7 | let _ = ratatui::restore(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `ratatui::restore();` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value = note: `#[warn(clippy::let_unit_value)]` on by default

Check warning on line 7 in src/terminal.rs

View workflow job for this annotation

GitHub Actions / check / beta / clippy

this let-binding has unit value

warning: this let-binding has unit value --> src/terminal.rs:7:9 | 7 | let _ = ratatui::restore(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: omit the `let` binding: `ratatui::restore();` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_unit_value = note: `#[warn(clippy::let_unit_value)]` on by default
original_hook(panic_info);
}));
}
9 changes: 5 additions & 4 deletions src/ui/page_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use std::sync::Arc;
use bollard::Docker;
use color_eyre::eyre::{Context, Result};
use ratatui::{
layout::{Alignment, Margin, Rect},
widgets::{block::Title, Block, Padding},
layout::{Margin, Rect},
text::Line,
widgets::{Block, Padding},
Frame,
};
use tokio::sync::mpsc::Sender;
Expand Down Expand Up @@ -182,11 +183,11 @@ impl Component for PageManager {
fn draw(&mut self, f: &mut Frame<'_>, area: Rect) {
let title_message = self.page.get_help().lock().unwrap().get_name();

let title = Title::from(format!("< {} >", title_message)).alignment(Alignment::Center);
let title = Line::from(format!("< {} >", title_message)).centered();

let block = Block::bordered()
.border_type(ratatui::widgets::BorderType::Plain)
.title(title)
.title_top(title)
.padding(Padding::left(300));

f.render_widget(block, area);
Expand Down
10 changes: 5 additions & 5 deletions src/widgets/modal.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
use ratatui::{
style::Style,
text::{Line, Span, Text},
widgets::{block::Title, Block, Clear, Paragraph, Widget, Wrap},
widgets::{Block, Clear, Paragraph, Widget, Wrap},
};
use ratatui_macros::{horizontal, vertical};

const UPPER_PAD_SIZE: u16 = 1;
const MID_PAD_SIZE: u16 = 1;

pub struct ModalWidget<'a> {
title: Title<'a>,
title: Line<'a>,
prompt: Paragraph<'a>,
opts: Vec<Span<'a>>,
width: u16,
height: u16,
}

impl<'a> ModalWidget<'a> {
pub fn new(title: Title<'a>, prompt: Paragraph<'a>, opts: Vec<Span<'a>>) -> Self {
pub fn new(title: Line<'a>, prompt: Paragraph<'a>, opts: Vec<Span<'a>>) -> Self {
Self {
title,
prompt,
Expand All @@ -30,7 +30,7 @@ impl<'a> ModalWidget<'a> {
impl<'a> Default for ModalWidget<'a> {

Check warning on line 30 in src/widgets/modal.rs

View workflow job for this annotation

GitHub Actions / check / stable / clippy

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a --> src/widgets/modal.rs:30:6 | 30 | impl<'a> Default for ModalWidget<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 30 - impl<'a> Default for ModalWidget<'a> { 30 + impl Default for ModalWidget<'_> { |

Check warning on line 30 in src/widgets/modal.rs

View workflow job for this annotation

GitHub Actions / check / beta / clippy

the following explicit lifetimes could be elided: 'a

warning: the following explicit lifetimes could be elided: 'a --> src/widgets/modal.rs:30:6 | 30 | impl<'a> Default for ModalWidget<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 30 - impl<'a> Default for ModalWidget<'a> { 30 + impl Default for ModalWidget<'_> { |
fn default() -> Self {
Self {
title: Title::from(""),
title: Line::from(""),
prompt: Paragraph::new(Text::from("")),
opts: vec![],
width: 60,
Expand All @@ -52,7 +52,7 @@ impl<'a> Widget for ModalWidget<'a> {
let [_, area, _] = vertical![>=0, ==height, >=0 ].areas(area);

let block = Block::bordered()
.title(self.title)
.title(self.title.centered())
.border_style(Style::default())
.style(Style::default());

Expand Down

0 comments on commit 0d45d5f

Please sign in to comment.