From 86bfe8894cb3452d62d56995ab185eca25014bb3 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Wed, 7 Sep 2022 18:00:42 +0000 Subject: [PATCH 1/6] docs: readme updated --- README.md | 2 +- containerised/DOCKERHUB_README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a6a9ac1..f5f5740 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Published on Docker Hub, with images built for `linux/amd64`, `linux/arm64v8`, and `linux/armv6` -`docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro mrjackwills/oxker:latest` +`docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro --pull=always mrjackwills/oxker` ## Download & install diff --git a/containerised/DOCKERHUB_README.md b/containerised/DOCKERHUB_README.md index 91da76d..729e79a 100644 --- a/containerised/DOCKERHUB_README.md +++ b/containerised/DOCKERHUB_README.md @@ -19,7 +19,7 @@ Images built for `linux/amd64`, `linux/arm64v8`, and `linux/armv6` -`docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro mrjackwills/oxker:latest` +`docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro --pull=always mrjackwills/oxker` ## Help From 81bc6cca1fb602f3a30bea011786a7ad6a2299a8 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Wed, 7 Sep 2022 18:01:15 +0000 Subject: [PATCH 2/6] fix: create_release.sh build option --- create_release.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/create_release.sh b/create_release.sh index 4fe3c85..3adbf36 100755 --- a/create_release.sh +++ b/create_release.sh @@ -230,6 +230,7 @@ main() { options=( 1 "test" off 2 "release" off + 3 "build" off ) choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty) exitStatus=$? @@ -250,6 +251,10 @@ main() { 2) release_flow break;; + 3) + cargo_build + main + break;; esac done } From acfca6ddac94d305a4e6ec55b048764887a2e1a1 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 19 Sep 2022 21:58:51 +0000 Subject: [PATCH 3/6] chore: Readme layout & typos --- README.md | 22 +++++++++------------- containerised/DOCKERHUB_README.md | 8 +++----- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index f5f5740..cb92d79 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,9 @@

-

- -

oxker

+
A simple tui to view & control docker containers

-

- A simple tui to view & control docker containers

@@ -22,7 +18,7 @@ ## Run via Docker -Published on Docker Hub, with images built for `linux/amd64`, `linux/arm64v8`, and `linux/armv6` +Published on Docker Hub, with images built for `linux/amd64`, `linux/arm64`, and `linux/arm/v6` `docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro --pull=always mrjackwills/oxker` @@ -51,12 +47,12 @@ rm oxker_linux_x86_64.tar.gz oxker In application controls | button| result| |--|--| -| ```( tab )``` or ```( shift+tab )``` | Change panel, clicking on a panel also changes the selected panel| -| ```( ↑ ↓ )``` or ```( j k )``` or ```(PgUp PgDown)``` or ```(Home End)```| Change selected line in selected panel, mouse scroll also changes selected line | +| ```( tab )``` or ```( shift+tab )``` | change panel, clicking on a panel also changes the selected panel| +| ```( ↑ ↓ )``` or ```( j k )``` or ```(PgUp PgDown)``` or ```(Home End)```| change selected line in selected panel, mouse scroll also changes selected line | | ```( enter )```| execute selected docker command| | ```( 1-9 )``` | sort containers by heading, clicking on headings also sorts the selected column | | ```( 0 )``` | stop sorting | -| ```( h )``` | Show help menu | +| ```( h )``` | toggle help menu | | ```( m )``` | toggle mouse capture - if disabled, text on screen can be selected| | ```( q )``` | to quit at any time | @@ -65,10 +61,10 @@ Available command line arguments | argument|result| |--|--| |```-d [number > 0]```| set the minimum update interval for docker information, in ms, defaults to 1000 (1 second) | -|```-r```| Show raw logs, by default oxker will remove ANSI formatting (conflicts with -c) | -|```-c```| Attempt to color the logs (conflicts with -r) | -|```-t```| Remove timestamps from each log entry | -|```-g```| No tui, basically a pointless debugging mode, for now | +|```-r```| show raw logs, by default oxker will remove ANSI formatting (conflicts with -c) | +|```-c```| attempt to color the logs (conflicts with -r) | +|```-t```| remove timestamps from each log entry | +|```-g```| no tui, basically a pointless debugging mode, for now | ## Build step diff --git a/containerised/DOCKERHUB_README.md b/containerised/DOCKERHUB_README.md index 729e79a..4339e01 100644 --- a/containerised/DOCKERHUB_README.md +++ b/containerised/DOCKERHUB_README.md @@ -1,8 +1,6 @@ -

- -

+

oxker

A simple tui to view & control docker containers @@ -17,10 +15,10 @@ ## Run -Images built for `linux/amd64`, `linux/arm64v8`, and `linux/armv6` +Images built for `linux/amd64`, `linux/arm64`, and `linux/arm/v6` `docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro --pull=always mrjackwills/oxker` ## Help -visit the Github repo \ No newline at end of file +visit the Github repo \ No newline at end of file From 37d87916721ab046f46e2419b5f11ab3722f4538 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 19 Sep 2022 21:59:09 +0000 Subject: [PATCH 4/6] chore: comment typos --- src/ui/gui_state.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ui/gui_state.rs b/src/ui/gui_state.rs index ec17be3..1239e20 100644 --- a/src/ui/gui_state.rs +++ b/src/ui/gui_state.rs @@ -22,14 +22,14 @@ impl SelectablePanel { Self::Commands => "", } } - pub fn next(self) -> Self { + pub const fn next(self) -> Self { match self { Self::Containers => Self::Commands, Self::Commands => Self::Logs, Self::Logs => Self::Containers, } } - pub fn prev(self) -> Self { + pub const fn prev(self) -> Self { match self { Self::Containers => Self::Logs, Self::Commands => Self::Containers, @@ -196,7 +196,7 @@ impl GuiState { } } - /// clear panels hash map, so on resize can fix the sizes for mouse clicks + /// Clear panels hash map, so on resize can fix the sizes for mouse clicks pub fn clear_area_map(&mut self) { self.panel_map.clear(); } @@ -224,7 +224,7 @@ impl GuiState { .map(|data| data.0.clone()) } - /// Insert, or updatem header area panel into heading_map + /// Insert, or updates header area panel into heading_map pub fn update_map(&mut self, region: Region, area: Rect) { match region { Region::Header(header) => self @@ -258,10 +258,10 @@ impl GuiState { /// if is_loading, return loading animation frame, else single space pub fn get_loading(&mut self) -> String { - if !self.is_loading.is_empty() { - self.loading_icon.to_string() - } else { + if self.is_loading.is_empty() { String::from(" ") + } else { + self.loading_icon.to_string() } } From 57c27d06c753b7b3028b055bfe363ce4c8b32567 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 19 Sep 2022 22:03:00 +0000 Subject: [PATCH 5/6] refactor: byte_stats one_kb/mb/gb made into consts --- src/app_data/container_state.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/app_data/container_state.rs b/src/app_data/container_state.rs index 6da9756..03c0c1c 100644 --- a/src/app_data/container_state.rs +++ b/src/app_data/container_state.rs @@ -7,6 +7,11 @@ use tui::{ use super::Header; + +const ONE_KB: f64 = 1000.0; +const ONE_MB: f64 = ONE_KB * 1000.0; +const ONE_GB: f64 = ONE_MB * 1000.0; + #[derive(Debug, Clone)] pub struct StatefulList { pub state: ListState, @@ -301,14 +306,12 @@ impl Stats for ByteStats { // convert from bytes to kB, MB, GB etc impl fmt::Display for ByteStats { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let one_kb = 1000.0; - let one_mb = one_kb * one_kb; - let one_gb = one_mb * 1000.0; + // TODO these can be consts outside of this definition let as_f64 = self.value as f64; let p = match as_f64 { - x if x >= one_gb => format!("{y:.2} GB", y = as_f64 / one_gb), - x if x >= one_kb => format!("{y:.2} MB", y = as_f64 / one_mb), - x if x >= one_mb => format!("{y:.2} kB", y = as_f64 / one_kb), + x if x >= ONE_GB => format!("{y:.2} GB", y = as_f64 / ONE_GB), + x if x >= ONE_MB => format!("{y:.2} MB", y = as_f64 / ONE_MB), + x if x >= ONE_KB => format!("{y:.2} kB", y = as_f64 / ONE_KB), _ => format!("{} B", self.value), }; write!(f, "{:>x$}", p, x = f.width().unwrap_or(1)) From cde843d2ade602f4723082ea74d0bb21ea988678 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Tue, 27 Sep 2022 19:50:33 -0400 Subject: [PATCH 6/6] fix: README & Comment typos --- README.md | 4 +--- src/app_data/mod.rs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cb92d79..acae78e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@

oxker

-
A simple tui to view & control docker containers -

- +
A simple tui to view & control docker containers

diff --git a/src/app_data/mod.rs b/src/app_data/mod.rs index a96b0e8..6c7924d 100644 --- a/src/app_data/mod.rs +++ b/src/app_data/mod.rs @@ -39,7 +39,7 @@ pub enum Header { Tx, } -/// Convert errors into strings to display +/// Convert Header enum into strings to display impl fmt::Display for Header { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let disp = match self {