Merge branch 'dev'

This commit is contained in:
Jack Wills
2022-09-27 19:51:08 -04:00
6 changed files with 36 additions and 36 deletions
+10 -16
View File
@@ -1,13 +1,7 @@
<p align="center">
<img src='./.github/logo.svg' width='100px'/>
</p>
<p align="center">
<h1 align="center">oxker</h1>
</p>
<p align="center">
A simple tui to view & control docker containers
<div align="center">A simple tui to view & control docker containers</div>
</p>
<p align="center">
@@ -22,9 +16,9 @@
## Run via Docker
Published on <a href='https://hub.docker.com/r/mrjackwills/oxker' target='_blank' rel='noopener noreferrer'>Docker Hub</a>, with images built for `linux/amd64`, `linux/arm64v8`, and `linux/armv6`
Published on <a href='https://hub.docker.com/r/mrjackwills/oxker' target='_blank' rel='noopener noreferrer'>Docker Hub</a>, 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 mrjackwills/oxker:latest`
`docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro --pull=always mrjackwills/oxker`
## Download & install
@@ -51,12 +45,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 +59,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
+3 -5
View File
@@ -1,8 +1,6 @@
<p align="center">
<img src='https://raw.githubusercontent.com/mrjackwills/oxker/main/.github/logo.svg' width='100px'/>
</p>
<p align="center">
<img src='https://raw.githubusercontent.com/mrjackwills/oxker/main/.github/logo.svg' width='100px'/>
<h1 align="center">oxker</h1>
<div align="center">
A simple tui to view & control docker containers
@@ -17,9 +15,9 @@
## 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 mrjackwills/oxker:latest`
`docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro --pull=always mrjackwills/oxker`
## Help
+5
View File
@@ -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
}
+9 -6
View File
@@ -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<T> {
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))
+1 -1
View File
@@ -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 {
+7 -7
View File
@@ -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()
}
}