diff --git a/.github/release-body.md b/.github/release-body.md
index 97a8a25..574549a 100644
--- a/.github/release-body.md
+++ b/.github/release-body.md
@@ -1,11 +1,13 @@
### 2022-07-23
### Chores
-+ dependencies updated, [cf7e02dde94f69832a2e485b99785afc66a5bc15]
++ update Cargo.toml, in preparation for crates.io publishing, [fdc6898e20c41415f03e310d7b84af4b6c39ab62]
-### Features
-+ Enable sorting of containers by each, and every, heading. Either via keyboard or mouse, closes [#3], [a6c296f2cde56cf241bcd696cab8bd477270e5f4]
-+ Spawn & track docker information update requests, multiple identical requests cannot be executed, [740c059b276f35acd1cb03f1030134646bf8a07d]
+### Docs
++ added cargo install instructions, [c774b10d557b10885b9d3a0b3612330a8ecb1cd5]
+
+### Fixes
++ use SpawnId for docker hashmap JoinHandle mapping, [1ae95d58c3302a95d5a0a2f0b61b126c72b6e166]
see CHANGELOG.md for more details
diff --git a/.github/screenshot_01.jpg b/.github/screenshot_01.jpg
index fc7d9a6..7d11678 100644
Binary files a/.github/screenshot_01.jpg and b/.github/screenshot_01.jpg differ
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6bf452f..6cafb76 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,15 @@
+# v0.1.1
+### 2022-07-23
+
+### Chores
++ update Cargo.toml, in preparation for crates.io publishing, [fdc6898e](https://github.com/mrjackwills/oxker/commit/fdc6898e20c41415f03e310d7b84af4b6c39ab62),
+
+### Docs
++ added cargo install instructions, [c774b10d](https://github.com/mrjackwills/oxker/commit/c774b10d557b10885b9d3a0b3612330a8ecb1cd5),
+
+### Fixes
++ use SpawnId for docker hashmap JoinHandle mapping, [1ae95d58](https://github.com/mrjackwills/oxker/commit/1ae95d58c3302a95d5a0a2f0b61b126c72b6e166),
+
# v0.1.0
### 2022-07-23
diff --git a/Cargo.toml b/Cargo.toml
index 44f4180..bec11bb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,12 +1,15 @@
[package]
name = "oxker"
-version = "0.1.0"
+version = "0.1.1"
edition = "2021"
authors = ["Jack Wills "]
description = "a simple tui to view & control docker containers"
repository = "https://github.com/mrjackwills/oxker"
+homepage = "https://github.com/mrjackwills/oxker"
license = "MIT"
readme = "README.md"
+keywords = ["docker", "tui", "tui-rs", "tokio"]
+categories = ["command-line-utilities"]
[dependencies]
anyhow = "1.0"
@@ -16,6 +19,7 @@ clap={version="3.2", features = ["derive", "unicode"] }
crossterm = "0.24"
futures-util = "0.3"
parking_lot = {version= "0.12"}
+reqwest = "0.11.11"
tokio = {version = "1.20", features=["full"]}
tracing = "0.1"
tracing-subscriber = "0.3"
diff --git a/README.md b/README.md
index 09b1fd8..5ec8231 100644
--- a/README.md
+++ b/README.md
@@ -23,9 +23,14 @@
## Download & install
-See releases
+Now published on crates.io, so if you have cargo installed, simply run
-download & install (x86_64 one liner)
+``` cargo install oxker```
+
+
+else see the pre-built binaries
+
+or, download & install (x86_64 one liner)
```bash
wget https://www.github.com/mrjackwills/oxker/releases/latest/download/oxker_linux_x86_64.tar.gz &&
@@ -51,7 +56,7 @@ In application controls
| ```( q )``` | to quit at any time |
-available command line arguments
+Available command line arguments
| argument|result|
|--|--|
|```-d [number > 0]```| set the minimum update interval for docker information, in ms, defaults to 1000 (1 second) |
diff --git a/src/docker_data/mod.rs b/src/docker_data/mod.rs
index 6cfe776..4e09a9a 100644
--- a/src/docker_data/mod.rs
+++ b/src/docker_data/mod.rs
@@ -6,6 +6,7 @@ use futures_util::StreamExt;
use parking_lot::Mutex;
use std::{
collections::HashMap,
+ fmt,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
@@ -22,6 +23,22 @@ use crate::{
mod message;
pub use message::DockerMessage;
+#[derive(Debug, Hash, Clone, PartialEq, Eq)]
+enum SpawnId {
+ Stats(String),
+ Log(String),
+}
+
+impl fmt::Display for SpawnId {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ let disp = match self {
+ Self::Stats(id) => format!("stats::{id}"),
+ Self::Log(id) => format!("logs::{id}"),
+ };
+ write!(f, "{}", disp)
+ }
+}
+
pub struct DockerData {
app_data: Arc>,
docker: Arc,
@@ -29,7 +46,7 @@ pub struct DockerData {
initialised: bool,
is_running: Arc,
receiver: Receiver,
- spawns: Arc>>>,
+ spawns: Arc>>>,
timestamps: bool,
}
@@ -69,7 +86,7 @@ impl DockerData {
id: String,
app_data: Arc>,
is_running: bool,
- spawns: Arc>>>,
+ spawns: Arc>>>,
) {
let mut stream = docker
.stats(
@@ -117,7 +134,8 @@ impl DockerData {
.lock()
.update_stats(id.clone(), None, None, mem_limit, rx, tx);
}
- spawns.lock().remove(&id);
+ let key = SpawnId::Stats(id.to_owned());
+ spawns.lock().remove(&key);
}
}
@@ -130,7 +148,8 @@ impl DockerData {
let is_running = *is_running;
let id = id.to_owned();
- let spawn_contains_id = spawns.lock().contains_key(&id);
+ let key = SpawnId::Stats(id.to_owned());
+ let spawn_contains_id = spawns.lock().contains_key(&key);
let s = tokio::spawn(Self::update_container_stat(
docker,
id.to_owned(),
@@ -139,7 +158,7 @@ impl DockerData {
spawns,
));
if !spawn_contains_id {
- self.spawns.lock().insert(id, s);
+ self.spawns.lock().insert(key, s);
}
}
}
@@ -190,7 +209,7 @@ impl DockerData {
timestamps: bool,
since: i64,
app_data: Arc>,
- spawns: Arc>>>,
+ spawns: Arc>>>,
) {
let options = Some(LogsOptions:: {
stdout: true,
@@ -211,7 +230,8 @@ impl DockerData {
}
}
}
- spawns.lock().remove(&id);
+ let key = SpawnId::Log(id.to_owned());
+ spawns.lock().remove(&key);
app_data.lock().update_log_by_id(output, id.to_owned());
}
@@ -223,12 +243,12 @@ impl DockerData {
let id = id.to_owned();
let app_data = Arc::clone(&self.app_data);
let spawns = Arc::clone(&self.spawns);
- self.spawns.lock().insert(
- id.to_owned(),
- tokio::spawn(Self::update_log(
- docker, id, timestamps, 0, app_data, spawns,
- )),
- );
+ let key = SpawnId::Log(id.to_owned());
+ let s = tokio::spawn(Self::update_log(
+ docker, id, timestamps, 0, app_data, spawns,
+ ));
+
+ self.spawns.lock().insert(key, s);
}
}
@@ -238,7 +258,8 @@ impl DockerData {
if let Some(index) = optional_index {
let id = self.app_data.lock().containers.items[index].id.to_owned();
- let running = self.spawns.lock().contains_key(&id);
+ let key = SpawnId::Log(id.to_owned());
+ let running = self.spawns.lock().contains_key(&key);
if !running {
let since = self.app_data.lock().containers.items[index].last_updated as i64;
@@ -248,14 +269,9 @@ impl DockerData {
let app_data = Arc::clone(&self.app_data);
let spawns = Arc::clone(&self.spawns);
let s = tokio::spawn(Self::update_log(
- docker,
- id.to_owned(),
- timestamps,
- since,
- app_data,
- spawns,
+ docker, id, timestamps, since, app_data, spawns,
));
- self.spawns.lock().insert(id, s);
+ self.spawns.lock().insert(key, s);
}
};