chore: merge release-v0.1.10 into main

This commit is contained in:
Jack Wills
2022-12-25 15:49:08 +00:00
13 changed files with 111 additions and 92 deletions
+12 -3
View File
@@ -1,8 +1,17 @@
### 2022-12-05
### 2022-12-25
### Chores
+ dependencies updated, [1525b3150293015c0fb2f2161da463b21ac2694c], [8d539ab14809136d743c49d60779687fc8eeef6d], [1774217a8a657d261397d213e5ecee667cf3b6b1]
+ Rust 1.66 linting, [bf9dcac7045c0d2314df147ec2744a3ad886564b]
### Features
+ Caching on github action, [a91c9aa45ffd5c998cd1b83d8e90d0912893c31f]
### Fixes
+ disallow commands to be sent to a dockerised oxker container, closes #19, [160b8021b1de898064756b53c127d49b8096ce4d]
+ if no container created time, use 0, instead of system_time(), [1adb61ce3b029d4fcf51961958d483b2fae8825a]
+ comment typo, [7899b773569fed86343a035d3023bf34297fdabb]
### Refactors
+ remove_ansi() to single liner, [57c3a6c186b916faba24bf7b5cdbbda31d636a7e]
see <a href='https://github.com/mrjackwills/oxker/blob/main/CHANGELOG.md'>CHANGELOG.md</a> for more details
@@ -27,6 +27,10 @@ jobs:
- name: install rust
uses: dtolnay/rust-toolchain@stable
# Setup caching - not sure if will have any effect
- name: Rust cache
uses: swatinem/rust-cache@v2
# Install cross-rs
- name: install cross
run: cargo install cross --git https://github.com/cross-rs/cross
+16
View File
@@ -1,3 +1,19 @@
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.1.10'>v0.1.10</a>
### 2022-12-25
### Chores
+ dependencies updated, [1525b315](https://github.com/mrjackwills/oxker/commit/1525b3150293015c0fb2f2161da463b21ac2694c), [8d539ab1](https://github.com/mrjackwills/oxker/commit/8d539ab14809136d743c49d60779687fc8eeef6d), [1774217a](https://github.com/mrjackwills/oxker/commit/1774217a8a657d261397d213e5ecee667cf3b6b1)
+ Rust 1.66 linting, [bf9dcac7](https://github.com/mrjackwills/oxker/commit/bf9dcac7045c0d2314df147ec2744a3ad886564b)
### Features
+ Caching on github action, [a91c9aa4](https://github.com/mrjackwills/oxker/commit/a91c9aa45ffd5c998cd1b83d8e90d0912893c31f)
### Fixes
+ comment typo, [7899b773](https://github.com/mrjackwills/oxker/commit/7899b773569fed86343a035d3023bf34297fdabb)
### Refactors
+ remove_ansi() to single liner, [57c3a6c1](https://github.com/mrjackwills/oxker/commit/57c3a6c186b916faba24bf7b5cdbbda31d636a7e)
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.1.9'>v0.1.9</a>
### 2022-12-05
Generated
+43 -52
View File
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "anyhow"
version = "1.0.66"
version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
[[package]]
name = "autocfg"
@@ -84,9 +84,9 @@ checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
[[package]]
name = "cc"
version = "1.0.77"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
[[package]]
name = "cfg-if"
@@ -96,9 +96,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "clap"
version = "4.0.29"
version = "4.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d"
checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39"
dependencies = [
"bitflags",
"clap_derive",
@@ -323,15 +323,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "hermit-abi"
version = "0.2.6"
@@ -456,11 +447,11 @@ dependencies = [
[[package]]
name = "is-terminal"
version = "0.4.1"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
dependencies = [
"hermit-abi 0.2.6",
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
@@ -468,9 +459,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "1.0.4"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
[[package]]
name = "lazy_static"
@@ -480,15 +471,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.138"
version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "linux-raw-sys"
version = "0.1.3"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]]
name = "lock_api"
@@ -539,11 +530,11 @@ dependencies = [
[[package]]
name = "num_cpus"
version = "1.14.0"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
dependencies = [
"hermit-abi 0.1.19",
"hermit-abi",
"libc",
]
@@ -676,18 +667,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.47"
version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.21"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [
"proc-macro2",
]
@@ -733,9 +724,9 @@ dependencies = [
[[package]]
name = "rustix"
version = "0.36.4"
version = "0.36.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588"
dependencies = [
"bitflags",
"errno",
@@ -747,9 +738,9 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.11"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
[[package]]
name = "scopeguard"
@@ -759,18 +750,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "serde"
version = "1.0.148"
version = "1.0.151"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc"
checksum = "97fed41fc1a24994d044e6db6935e69511a1153b52c15eb42493b26fa87feba0"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.148"
version = "1.0.151"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c"
checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8"
dependencies = [
"proc-macro2",
"quote",
@@ -779,9 +770,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.89"
version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
dependencies = [
"itoa",
"ryu",
@@ -894,9 +885,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "1.0.105"
version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [
"proc-macro2",
"quote",
@@ -914,18 +905,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.37"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.37"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [
"proc-macro2",
"quote",
@@ -958,9 +949,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.22.0"
version = "1.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3"
checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46"
dependencies = [
"autocfg",
"bytes",
@@ -973,7 +964,7 @@ dependencies = [
"signal-hook-registry",
"socket2",
"tokio-macros",
"winapi",
"windows-sys",
]
[[package]]
@@ -1101,9 +1092,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]]
name = "unicode-ident"
version = "1.0.5"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]]
name = "unicode-normalization"
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "oxker"
version = "0.1.9"
version = "0.1.10"
edition = "2021"
authors = ["Jack Wills <email@mrjackwills.com>"]
description = "A simple tui to view & control docker containers"
@@ -19,7 +19,7 @@ clap={version="4.0", features = ["derive", "unicode", "color"] }
crossterm = "0.25"
futures-util = "0.3"
parking_lot = {version= "0.12"}
tokio = {version = "1.22", features=["full"]}
tokio = {version = "1.23", features=["full"]}
tracing = "0.1"
tracing-subscriber = "0.3"
tui = "0.19"
+6 -6
View File
@@ -111,7 +111,7 @@ impl<T> StatefulList<T> {
.state
.selected()
.map_or(0, |value| if len > 0 { value + 1 } else { value });
format!("{}/{}", c, self.items.len())
format!("{c}/{}", self.items.len())
}
}
}
@@ -191,7 +191,7 @@ impl fmt::Display for State {
Self::Running => "✓ running",
Self::Unknown => "? unknown",
};
write!(f, "{}", disp)
write!(f, "{disp}")
}
}
@@ -237,7 +237,7 @@ impl fmt::Display for DockerControls {
Self::Stop => "stop",
Self::Unpause => "unpause",
};
write!(f, "{}", disp)
write!(f, "{disp}")
}
}
@@ -292,7 +292,7 @@ impl Stats for CpuStats {
impl fmt::Display for CpuStats {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let disp = format!("{:05.2}%", self.0);
write!(f, "{:>x$}", disp, x = f.width().unwrap_or(1))
write!(f, "{disp:>x$}", x = f.width().unwrap_or(1))
}
}
@@ -346,7 +346,7 @@ impl fmt::Display for ByteStats {
x if x >= ONE_KB => format!("{y:.2} kB", y = as_f64 / ONE_KB),
_ => format!("{} B", self.0),
};
write!(f, "{:>x$}", p, x = f.width().unwrap_or(1))
write!(f, "{p:>x$}", x = f.width().unwrap_or(1))
}
}
@@ -429,7 +429,7 @@ impl ContainerItem {
self.cpu_stats
.iter()
.enumerate()
.map(|i| (i.0 as f64, i.1 .0 as f64))
.map(|i| (i.0 as f64, i.1 .0))
.collect::<Vec<_>>()
}
+3 -3
View File
@@ -51,7 +51,7 @@ impl fmt::Display for Header {
Self::Rx => "↓ rx",
Self::Tx => "↑ tx",
};
write!(f, "{:>x$}", disp, x = f.width().unwrap_or(1))
write!(f, "{disp:>x$}", x = f.width().unwrap_or(1))
}
}
@@ -280,9 +280,9 @@ impl AppData {
let mut name = self.containers.items[index].name.clone();
name.truncate(32);
if logs_len.is_empty() {
format!("- {} ", name)
format!("- {name} ")
} else {
format!("{} - {}", logs_len, name)
format!("{logs_len} - {name}")
}
})
}
+2 -2
View File
@@ -17,13 +17,13 @@ pub enum AppError {
impl fmt::Display for AppError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Self::DockerCommand(s) => write!(f, "Unable to {} container", s),
Self::DockerCommand(s) => write!(f, "Unable to {s} container"),
Self::DockerConnect => write!(f, "Unable to access docker daemon"),
Self::DockerInterval => write!(f, "Docker update interval needs to be greater than 0"),
Self::InputPoll => write!(f, "Unable to poll user input"),
Self::MouseCapture(x) => {
let reason = if *x { "en" } else { "dis" };
write!(f, "Unbale to {}able mouse capture", reason)
write!(f, "Unable to {reason}able mouse capture")
}
Self::Terminal => write!(f, "Unable to draw to terminal"),
}
+1 -1
View File
@@ -3,7 +3,7 @@
// Wanring - These are indeed pedantic
// #![warn(clippy::pedantic)]
// #![warn(clippy::nursery)]
// #![allow(clippy::module_name_repetitions, clippy::doc_markdown)]
// #![allow(clippy::module_name_repetitions, clippy::doc_markdown, clippy::similar_names)]
// Only allow when debugging
// #![allow(unused)]
+4 -5
View File
@@ -41,11 +41,10 @@ pub mod log_sanitizer {
/// Remove all ansi formatting from a given string and create tui-rs spans
pub fn remove_ansi<'a>(input: &str) -> Vec<Spans<'a>> {
let mut output = String::new();
for i in categorise_text(input) {
output.push_str(i.text);
}
raw(&output)
raw(&categorise_text(input)
.into_iter()
.map(|i| i.text)
.collect::<String>())
}
/// create tui-rs spans that exactly match the given strings
+16 -16
View File
@@ -148,7 +148,7 @@ pub fn containers<B: Backend>(
state_style,
),
Span::styled(
format!("{}{:>width$}", MARGIN, i.status, width = &widths.status.1),
format!("{MARGIN}{:>width$}", i.status, width = &widths.status.1),
state_style,
),
Span::styled(
@@ -161,7 +161,7 @@ pub fn containers<B: Backend>(
state_style,
),
Span::styled(
format!("{}{:>width$}", MARGIN, mems, width = &widths.mem.1),
format!("{MARGIN}{mems:>width$}", width = &widths.mem.1),
state_style,
),
Span::styled(
@@ -174,19 +174,19 @@ pub fn containers<B: Backend>(
blue,
),
Span::styled(
format!("{}{:>width$}", MARGIN, i.name, width = widths.name.1),
format!("{MARGIN}{:>width$}", i.name, width = widths.name.1),
blue,
),
Span::styled(
format!("{}{:>width$}", MARGIN, i.image, width = widths.image.1),
format!("{MARGIN}{:>width$}", i.image, width = widths.image.1),
blue,
),
Span::styled(
format!("{}{:>width$}", MARGIN, i.rx, width = widths.net_rx.1),
format!("{MARGIN}{:>width$}", i.rx, width = widths.net_rx.1),
Style::default().fg(Color::Rgb(255, 233, 193)),
),
Span::styled(
format!("{}{:>width$}", MARGIN, i.tx, width = widths.net_tx.1),
format!("{MARGIN}{:>width$}", i.tx, width = widths.net_tx.1),
Style::default().fg(Color::Rgb(205, 140, 140)),
),
]);
@@ -220,7 +220,7 @@ pub fn logs<B: Backend>(
let block = generate_block(app_data, area, gui_state, SelectablePanel::Logs);
let contains_init = gui_state.lock().status_contains(&[Status::Init]);
if contains_init {
let paragraph = Paragraph::new(format!("parsing logs {}", loading_icon))
let paragraph = Paragraph::new(format!("parsing logs {loading_icon}"))
.style(Style::default())
.block(block)
.alignment(Alignment::Center);
@@ -309,7 +309,7 @@ fn make_chart<'a, T: Stats + Display>(
Block::default()
.title_alignment(Alignment::Center)
.title(Span::styled(
format!(" {} {} ", name, current),
format!(" {name} {current} "),
Style::default()
.fg(title_color)
.add_modifier(Modifier::BOLD),
@@ -327,7 +327,7 @@ fn make_chart<'a, T: Stats + Display>(
.labels(vec![
Span::styled("", Style::default().fg(label_color)),
Span::styled(
format!("{}", max),
format!("{max}"),
Style::default()
.add_modifier(Modifier::BOLD)
.fg(label_color),
@@ -355,7 +355,7 @@ pub fn heading_bar<B: Backend>(
f.render_widget(block(Color::Black), area);
// Generate a bloack for the header, if the header is currently being used to sort a column, then highlight it white
// Generate a block for the header, if the header is currently being used to sort a column, then highlight it white
let header_block = |x: &Header| {
let mut color = Color::Black;
let mut suffix = "";
@@ -432,7 +432,7 @@ pub fn heading_bar<B: Backend>(
.collect::<Vec<_>>();
let suffix = if help_visible { "exit" } else { "show" };
let info_text = format!("( h ) {} help {}", suffix, MARGIN,);
let info_text = format!("( h ) {suffix} help {MARGIN}",);
let info_width = info_text.chars().count();
let column_width = usize::from(area.width) - info_width;
@@ -453,7 +453,7 @@ pub fn heading_bar<B: Backend>(
.split(area);
if has_containers {
// Draw loading icon, or not, and a prefix with a single space
let loading_icon = format!("{:>2}", loading_icon);
let loading_icon = format!("{loading_icon:>2}");
let loading_paragraph = Paragraph::new(loading_icon)
.block(block(Color::White))
.alignment(Alignment::Center);
@@ -507,9 +507,9 @@ fn max_line_width(text: &str) -> usize {
/// Draw the help box in the centre of the screen
/// TODO should make every line it's own renderable span
pub fn help_box<B: Backend>(f: &mut Frame<'_, B>) {
let title = format!(" {} ", VERSION);
let title = format!(" {VERSION} ");
let description_text = format!("\n{}", DESCRIPTION);
let description_text = format!("\n{DESCRIPTION}");
let mut help_text = String::from("\n ( tab ) or ( shift+tab ) to change panels");
help_text
@@ -527,7 +527,7 @@ pub fn help_box<B: Backend>(f: &mut Frame<'_, B>) {
help_text.push_str(format!("\n {}", REPO.trim()).as_str());
// Find the maximum line widths & height
let all_text = format!("{}{}{}", NAME_TEXT, description_text, help_text);
let all_text = format!("{NAME_TEXT}{description_text}{help_text}");
let mut max_line_width = max_line_width(&all_text);
let mut lines = all_text.lines().count();
@@ -604,7 +604,7 @@ pub fn error<B: Backend>(f: &mut Frame<'_, B>, error: AppError, seconds: Option<
_ => String::from("\n\n ( c ) to clear error\n ( q ) to quit oxker"),
};
let mut text = format!("\n{}", error);
let mut text = format!("\n{error}");
text.push_str(to_push.as_str());
+1 -1
View File
@@ -169,7 +169,7 @@ impl fmt::Display for Loading {
Self::Nine => '⠇',
Self::Ten => '⠏',
};
write!(f, "{}", disp)
write!(f, "{disp}")
}
}
+1 -1
View File
@@ -67,7 +67,7 @@ pub async fn create_ui(
terminal.show_cursor()?;
if let Err(err) = res {
println!("{}", err);
println!("{err}");
}
Ok(())
}