chore: merge release-v0.0.3 into main

This commit is contained in:
Jack Wills
2022-05-08 19:30:42 +00:00
9 changed files with 119 additions and 141 deletions
+12 -8
View File
@@ -1,15 +1,19 @@
### 2022-04-29
### 2022-05-08
### Docs
+ slight readme tweaks, [eb9184a1aee64be1c20fabd482bfcbe676bed049]
### Features
+ allow toggling of mouse caputre, to select & copy text with mouse, closes [#2], [aec184ea22b289e91942a4c3e6a415685884bc47]
+ show id column, [b10f927481c9e38a48c1d4b94e744ec48e8b6ba6]
+ draw_popup, using enum to draw in one of 9 areas, closes [#6], [1017850a6cc91328abc1127bdb117495f5e909d8]
+ use a message rx/sx for all docker commands, remove update loop, wait for update message from gui instead, [9b70fdfad7b38361ebee301bdc2545d3f0dfcf9e]
+ vim movement keys, 'j' & 'k', to move through menus, thanks [siph](https://github.com/siph), [77eb33c008e36965d84d1eafbbc3733af19fd262]
### Fixes
+ readme.md typo, [589501f9a4a0bfabdb0654e68cc0c752c529d97a]
+ column heading mem > memory, [5e8e6b590b06f01a542fdd10bae8f14d303ab08a]
+ cargo fmt added to create_release.sh, [bb29c0ebfafd6a9a036eb317a240954d1405966e]
+ create_release.sh correctly link to closed issues, [5820d0a9b68ead71d031377c5d22138675d7dfa8]
### Refactors
+ generate_block reduce params, insert into area hashmap from inside generate_block function, [32705a60c4f865eb829cc460b2ac82db79107c1a]
+ dead code removed, [d20e1bcd47965859a04f8e080509a5afb2de36d9]
+ create_release.sh improved flow & comments, [4283a285e2e60907e432294e3b97a759ec06a23d]
see <a href='https://github.com/mrjackwills/oxker/blob/main/CHANGELOG.md'>CHANGELOG.md</a> for more details
+25 -7
View File
@@ -1,16 +1,34 @@
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.0.3'>v0.0.3</a>
### 2022-05-08
### Docs
+ slight readme tweaks, [eb9184a1](https://github.com/mrjackwills/oxker/commit/eb9184a1aee64be1c20fabd482bfcbe676bed049),
### Features
+ vim movement keys, 'j' & 'k', to move through menus, thanks [siph](https://github.com/siph), [77eb33c0](https://github.com/mrjackwills/oxker/commit/77eb33c008e36965d84d1eafbbc3733af19fd262),
### Fixes
+ create_release.sh correctly link to closed issues, [5820d0a9](https://github.com/mrjackwills/oxker/commit/5820d0a9b68ead71d031377c5d22138675d7dfa8),
### Refactors
+ generate_block reduce params, insert into area hashmap from inside generate_block function, [32705a60](https://github.com/mrjackwills/oxker/commit/32705a60c4f865eb829cc460b2ac82db79107c1a),
+ dead code removed, [d20e1bcd](https://github.com/mrjackwills/oxker/commit/d20e1bcd47965859a04f8e080509a5afb2de36d9),
+ create_release.sh improved flow & comments, [4283a285](https://github.com/mrjackwills/oxker/commit/4283a285e2e60907e432294e3b97a759ec06a23d),
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.0.2'>v0.0.2</a>
### 2022-04-29
### Features
+ allow toggling of mouse caputre, to select & copy text with mouse, closes [#2], [aec184ea22b289e91942a4c3e6a415685884bc47](https://github.com/mrjackwills/oxker/commit/aec184ea22b289e91942a4c3e6a415685884bc47),
+ show id column, [b10f927481c9e38a48c1d4b94e744ec48e8b6ba6](https://github.com/mrjackwills/oxker/commit/b10f927481c9e38a48c1d4b94e744ec48e8b6ba6),
+ draw_popup, using enum to draw in one of 9 areas, closes [#6], [1017850a6cc91328abc1127bdb117495f5e909d8](https://github.com/mrjackwills/oxker/commit/1017850a6cc91328abc1127bdb117495f5e909d8),
+ use a message rx/sx for all docker commands, remove update loop, wait for update message from gui instead, [9b70fdfad7b38361ebee301bdc2545d3f0dfcf9e](https://github.com/mrjackwills/oxker/commit/9b70fdfad7b38361ebee301bdc2545d3f0dfcf9e),
+ allow toggling of mouse caputre, to select & copy text with mouse, closes #2, [aec184ea](https://github.com/mrjackwills/oxker/commit/aec184ea22b289e91942a4c3e6a415685884bc47),
+ show id column, [b10f9274](https://github.com/mrjackwills/oxker/commit/b10f927481c9e38a48c1d4b94e744ec48e8b6ba6),
+ draw_popup, using enum to draw in one of 9 areas, closes #6, [1017850a](https://github.com/mrjackwills/oxker/commit/1017850a6cc91328abc1127bdb117495f5e909d8),
+ use a message rx/sx for all docker commands, remove update loop, wait for update message from gui instead, [9b70fdfa](https://github.com/mrjackwills/oxker/commit/9b70fdfad7b38361ebee301bdc2545d3f0dfcf9e),
### Fixes
+ readme.md typo, [589501f9a4a0bfabdb0654e68cc0c752c529d97a](https://github.com/mrjackwills/oxker/commit/589501f9a4a0bfabdb0654e68cc0c752c529d97a),
+ column heading mem > memory, [5e8e6b590b06f01a542fdd10bae8f14d303ab08a](https://github.com/mrjackwills/oxker/commit/5e8e6b590b06f01a542fdd10bae8f14d303ab08a),
+ cargo fmt added to create_release.sh, [bb29c0ebfafd6a9a036eb317a240954d1405966e](https://github.com/mrjackwills/oxker/commit/bb29c0ebfafd6a9a036eb317a240954d1405966e),
+ readme.md typo, [589501f9](https://github.com/mrjackwills/oxker/commit/589501f9a4a0bfabdb0654e68cc0c752c529d97a),
+ column heading mem > memory, [5e8e6b59](https://github.com/mrjackwills/oxker/commit/5e8e6b590b06f01a542fdd10bae8f14d303ab08a),
+ cargo fmt added to create_release.sh, [bb29c0eb](https://github.com/mrjackwills/oxker/commit/bb29c0ebfafd6a9a036eb317a240954d1405966e),
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.0.1'>v0.0.1</a>
### 2022-04-25
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "oxker"
version = "0.0.2"
version = "0.0.3"
edition = "2021"
authors = ["Jack Wills <email@mrjackwills.com>"]
description = "a simple tui to view & control docker containers"
+2 -9
View File
@@ -7,7 +7,7 @@
</p>
<p align="center">
A simple tui to view and control docker containers
A simple tui to view & control docker containers
</p>
<p align="center">
@@ -39,7 +39,7 @@ rm oxker_linux_x86_64.tar.gz oxker
available command line arguments
| argument|result|
|--|--|
|```-d [number > 0]```| set the update interval for docker information, in ms |
|```-d [number > 0]```| set the 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 |
@@ -55,7 +55,6 @@ available command line arguments
requires docker & <a href='https://github.com/cross-rs/cross' target='_blank' rel='noopener noreferrer'>cross-rs</a>
#### 64bit pi (pi 4, pi zero w 2)
```cross build --target aarch64-unknown-linux-gnu --release```
@@ -72,12 +71,6 @@ If no memory information available, try appending ```/boot/cmdline.txt``` with
see <a href="https://forums.raspberrypi.com/viewtopic.php?t=203128" target='_blank' rel='noopener noreferrer'>https://forums.raspberrypi.com/viewtopic.php?t=203128</a> and <a href="https://github.com/docker/for-linux/issues/1112" target='_blank' rel='noopener noreferrer'>https://github.com/docker/for-linux/issues/1112</a>
### Compress executable
compress output from \~3mb to ~1mb
```upx --best --lzma target/release/oxker -o ./oxker```
### Untested on other platforms
## Tests
+45 -48
View File
@@ -1,7 +1,7 @@
#!/bin/bash
# rust create_release
# v0.0.14
# v0.0.15
PACKAGE_NAME='oxker'
STAR_LINE='****************************************'
@@ -20,7 +20,6 @@ error_close() {
exit 1
}
if [ -z "$PACKAGE_NAME" ]
then
error_close "No package name"
@@ -96,25 +95,37 @@ ask_changelog_update() {
fi
}
# Edit the release-body to include new liens from changelog
# Edit the release-body to include new lines from changelog
# add commit urls to changelog
# $1 RELEASE_BODY
update_release_body_and_changelog () {
echo -e
DATE_SUBHEADING="### $(date +'%Y-%m-%d')\n\n"
RELEASE_BODY_ADDITION="${DATE_SUBHEADING}$1"
# Put new changelog entries into release-body, add link to changelog
echo -e "${RELEASE_BODY_ADDITION}\n\nsee <a href='${GIT_REPO_URL}/blob/main/CHANGELOG.md'>CHANGELOG.md</a> for more details" > .github/release-body.md
echo -e "# <a href='${GIT_REPO_URL}/releases/tag/${NEW_TAG_VERSION}'>${NEW_TAG_VERSION}</a>\n${DATE_SUBHEADING}${CHANGELOG_ADDITION}$(cat CHANGELOG.md)" > CHANGELOG.md
sed -i -E "s=(\s)\[([0-9a-f]{40})\](\n|\s|\,|\r)= [\2](${GIT_REPO_URL}/commit/\2),=g" ./CHANGELOG.md
# Add subheading with release version and date of release
echo -e "# <a href='${GIT_REPO_URL}/releases/tag/${NEW_TAG_WITH_V}'>${NEW_TAG_WITH_V}</a>\n${DATE_SUBHEADING}${CHANGELOG_ADDITION}$(cat CHANGELOG.md)" > CHANGELOG.md
# Update changelog to add links to commits [hex:8](url_with_full_commit)
# "[aaaaaaaaaabbbbbbbbbbccccccccccddddddddd]" -> "[aaaaaaaa](https:/www.../commit/aaaaaaaaaabbbbbbbbbbccccccccccddddddddd),"
sed -i -E "s=(\s)\[([0-9a-f]{8})([0-9a-f]{32})\]= [\2](${GIT_REPO_URL}/commit/\2\3),=g" ./CHANGELOG.md
# Update changelog to add links to closed issues - comma included!
# "closes [#1]," -> "closes [#1](https:/www.../issues/1),""
sed -i -r -E "s=closes \[#([0-9]+)\],=closes [#\1](${GIT_REPO_URL}/issues/\1),=g" ./CHANGELOG.md
}
# update version in cargo.toml, to match selected current version/tag
update_cargo_toml () {
sed -i "s|^version = .*|version = \"${NEW_TAG_VERSION:1}\"|" Cargo.toml
# update version in cargo.toml, to match selected current version
update_version_number_in_files () {
sed -i "s|^version = .*|version = \"${MAJOR}.${MINOR}.${PATCH}\"|" Cargo.toml
}
# Work out the current version, based on git tags
# create new semver version based on user input
# Set MAJOR MINOR PATCH
check_tag () {
LATEST_TAG=$(git describe --tags --abbrev=0 --always)
echo -e "\nCurrent tag: ${PURPLE}${LATEST_TAG}${RESET}\n"
@@ -127,24 +138,24 @@ check_tag () {
MINOR="0"
PATCH="0"
fi
MAJOR_TAG=v$(update_major)
MINOR_TAG=v$(update_minor)
PATCH_TAG=v$(update_patch)
OP_MAJOR="major___$MAJOR_TAG"
OP_MINOR="minor___$MINOR_TAG"
OP_PATCH="patch___$PATCH_TAG"
OP_MAJOR="major___v$(update_major)"
OP_MINOR="minor___v$(update_minor)"
OP_PATCH="patch___v$(update_patch)"
OPTIONS=("$OP_MAJOR" "$OP_MINOR" "$OP_PATCH")
select choice in "${OPTIONS[@]}"
do
case $choice in
"$OP_MAJOR" )
NEW_TAG_VERSION="$MAJOR_TAG"
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
break;;
"$OP_MINOR")
NEW_TAG_VERSION="$MINOR_TAG"
MINOR=$((MINOR + 1))
PATCH=0
break;;
"$OP_PATCH")
NEW_TAG_VERSION="$PATCH_TAG"
PATCH=$((PATCH + 1))
break;;
*)
error_close "invalid option $REPLY"
@@ -168,39 +179,30 @@ cargo_test () {
ask_continue
}
# Build for linux, pi 32, pi 64, and windows
cargo_build_all() {
cargo build --release
cross build --target aarch64-unknown-linux-musl --release
cross build --target arm-unknown-linux-musleabihf --release
cross build --target x86_64-pc-windows-gnu --release
tar -C target/arm-unknown-linux-musleabihf/release -czf ./releases/oxker_linux_armv6.tar.gz oxker
tar -C target/aarch64-unknown-linux-musl/release -czf ./releases/oxker_linux_aarch64.tar.gz oxker
zip -j ./releases/oxker_windows_x86_64.zip target/x86_64-pc-windows-gnu/release/oxker.exe
tar -C target/release -czf ./releases/oxker_linux_x86_64.tar.gz oxker
}
# Full flow to create a new release
release_flow() {
check_git
get_git_remote_url
cargo fmt
cargo_test
cd "${CWD}" || error_close "Can't find ${CWD}"
check_tag
printf "\nnew tag chosen: %s\n\n" "${NEW_TAG_VERSION}"
RELEASE_BRANCH=release-$NEW_TAG_VERSION
NEW_TAG_WITH_V="v${MAJOR}.${MINOR}.${PATCH}"
printf "\nnew tag chosen: %s\n\n" "${NEW_TAG_WITH_V}"
RELEASE_BRANCH=release-$NEW_TAG_WITH_V
echo -e
ask_changelog_update
git checkout -b "$RELEASE_BRANCH"
update_cargo_toml
cargo fmt
update_version_number_in_files
git add .
git commit -m "chore: release $NEW_TAG_VERSION"
git commit -m "chore: release $NEW_TAG_WITH_V"
git checkout main
git merge --no-ff "$RELEASE_BRANCH" -m "chore: merge ${RELEASE_BRANCH} into main"
git tag -am "${RELEASE_BRANCH}" "$NEW_TAG_VERSION"
echo "git tag -am \"${RELEASE_BRANCH}\" \"$NEW_TAG_VERSION\""
git push --atomic origin main "$NEW_TAG_VERSION"
git tag -am "${RELEASE_BRANCH}" "$NEW_TAG_WITH_V"
echo "git tag -am \"${RELEASE_BRANCH}\" \"$NEW_TAG_WITH_V\""
git push --atomic origin main "$NEW_TAG_WITH_V"
git checkout dev
git merge --no-ff main -m 'chore: merge main into dev'
git branch -d "$RELEASE_BRANCH"
@@ -210,10 +212,9 @@ release_flow() {
main() {
cmd=(dialog --backtitle "Choose build option" --radiolist "choose" 14 80 16)
options=(
1 "fmt" off
2 "build" off
3 "test" off
4 "release" off
1 "build" off
2 "test" off
3 "release" off
)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
exitStatus=$?
@@ -228,18 +229,14 @@ main() {
exit
break;;
1)
cargo fmt
main
break;;
2)
cargo_build_all
main
break;;
3)
npm_test
2)
cargo_test
main
break;;
4)
3)
release_flow
break;;
esac
+2 -2
View File
@@ -158,13 +158,13 @@ impl InputHandler {
SelectablePanel::Commands => locked_data.docker_command_end(),
}
}
KeyCode::Up => self.previous(),
KeyCode::Up | KeyCode::Char('k') => self.previous(),
KeyCode::PageUp => {
for _ in 0..=6 {
self.previous()
}
}
KeyCode::Down => self.next(),
KeyCode::Down | KeyCode::Char('j') => self.next(),
KeyCode::PageDown => {
for _ in 0..=6 {
self.next()
-3
View File
@@ -15,9 +15,6 @@ pub struct CliArgs {
#[clap(short = 'g')]
pub gui: bool,
// /// Install to ./local/bin
// #[clap(short = 'i')]
// pub install: bool,
/// Remove timestamps from Docker logs
#[clap(short = 't')]
pub timestamp: bool,
+25 -40
View File
@@ -42,32 +42,32 @@ const MARGIN: &str = " ";
/// Generate block, add a border if is the selected panel,
/// add custom title based on state of each panel
fn generate_block<'a>(
selectable_panel: Option<SelectablePanel>,
app_data: &Arc<Mutex<AppData>>,
selected_panel: &SelectablePanel,
area: Rect,
gui_state: &Arc<Mutex<GuiState>>,
panel: SelectablePanel,
) -> Block<'a> {
gui_state.lock().insert_into_area_map(panel, area);
let mut block = Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded);
if let Some(panel) = selectable_panel {
let title = match panel {
SelectablePanel::Containers => {
format!(
" {} {} ",
panel.title(),
app_data.lock().containers.get_state_title()
)
}
SelectablePanel::Logs => {
format!(" {} {} ", panel.title(), app_data.lock().get_log_title())
}
_ => String::from(""),
};
block = block.title(title);
if selected_panel == &panel {
block = block.border_style(Style::default().fg(Color::LightCyan));
let current_selected_panel = gui_state.lock().selected_panel;
let title = match panel {
SelectablePanel::Containers => {
format!(
" {} {} ",
panel.title(),
app_data.lock().containers.get_state_title()
)
}
SelectablePanel::Logs => {
format!(" {} {} ", panel.title(), app_data.lock().get_log_title())
}
_ => String::from(""),
};
block = block.title(title);
if current_selected_panel == panel {
block = block.border_style(Style::default().fg(Color::LightCyan));
}
block
}
@@ -79,13 +79,8 @@ pub fn draw_commands<B: Backend>(
f: &mut Frame<'_, B>,
gui_state: &Arc<Mutex<GuiState>>,
index: Option<usize>,
selected_panel: &SelectablePanel,
) {
let panel = SelectablePanel::Commands;
let block = generate_block(Some(panel), app_data, selected_panel);
gui_state.lock().insert_into_area_map(panel, area);
let block = generate_block(app_data, area, gui_state, SelectablePanel::Commands);
if let Some(i) = index {
let items = app_data.lock().containers.items[i]
.docker_controls
@@ -125,13 +120,9 @@ pub fn draw_containers<B: Backend>(
area: Rect,
f: &mut Frame<'_, B>,
gui_state: &Arc<Mutex<GuiState>>,
selected_panel: &SelectablePanel,
widths: &Columns,
) {
let panel = SelectablePanel::Containers;
let block = generate_block(Some(panel), app_data, selected_panel);
gui_state.lock().insert_into_area_map(panel, area);
let block = generate_block(app_data, area, gui_state, SelectablePanel::Containers);
let items = app_data
.lock()
@@ -216,7 +207,7 @@ pub fn draw_containers<B: Backend>(
}
}
/// Draw the selectable panels
/// Draw the logs panels
pub fn draw_logs<B: Backend>(
app_data: &Arc<Mutex<AppData>>,
area: Rect,
@@ -224,17 +215,11 @@ pub fn draw_logs<B: Backend>(
gui_state: &Arc<Mutex<GuiState>>,
index: Option<usize>,
loading_icon: String,
selected_panel: &SelectablePanel,
) {
let panel = SelectablePanel::Logs;
gui_state.lock().insert_into_area_map(panel, area);
let block = generate_block(Some(panel), app_data, selected_panel);
let block = generate_block(app_data, area, gui_state, SelectablePanel::Logs);
let init = app_data.lock().init;
if !init {
// let icon = gui_state.lock().get_loading();
let parsing_logs = format!("parsing logs {}", loading_icon);
let paragraph = Paragraph::new(parsing_logs)
.style(Style::default())
@@ -475,7 +460,7 @@ pub fn draw_help_box<B: Backend>(f: &mut Frame<'_, B>) {
let description_text = format!("\n{}", DESCRIPTION);
let mut help_text = String::from("\n ( tab ) or ( alt+tab ) to change panels");
help_text.push_str("\n ( ↑ ↓ ← → ) to change selected line");
help_text.push_str("\n ( ↑ ↓ ← → ) or ( j k ) to change selected line");
help_text.push_str("\n ( enter ) to send docker container commands");
help_text.push_str("\n ( h ) to toggle this help information");
help_text.push_str(
+2 -18
View File
@@ -153,7 +153,6 @@ fn ui<B: Backend>(
let has_containers = !app_data.lock().containers.items.is_empty();
let has_error = app_data.lock().get_error();
let log_index = app_data.lock().get_selected_log_index();
let selected_panel = gui_state.lock().selected_panel;
let show_help = gui_state.lock().show_help;
let info_text = gui_state.lock().info_box_text.clone();
let loading_icon = gui_state.lock().get_loading();
@@ -192,24 +191,10 @@ fn ui<B: Backend>(
.constraints(lower_split.as_ref())
.split(upper_main[1]);
draw_containers(
app_data,
top_panel[0],
f,
gui_state,
&selected_panel,
&column_widths,
);
draw_containers(app_data, top_panel[0], f, gui_state, &column_widths);
if has_containers {
draw_commands(
app_data,
top_panel[1],
f,
gui_state,
log_index,
&selected_panel,
);
draw_commands(app_data, top_panel[1], f, gui_state, log_index);
}
draw_logs(
@@ -219,7 +204,6 @@ fn ui<B: Backend>(
gui_state,
log_index,
loading_icon.to_owned(),
&selected_panel,
);
draw_heading_bar(