From d28509bbedf73d4640230bcaa82965e0757c5187 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Fri, 29 Apr 2022 18:04:04 +0000 Subject: [PATCH 01/15] docs: changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e484f0..1dd7552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ ### 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), ++ 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), ++ 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), ### Fixes From ec14c85e98210973f2d457031bebf5410bd7dce0 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Fri, 29 Apr 2022 18:04:57 +0000 Subject: [PATCH 02/15] docs: changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dd7552..4a37a53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ ### 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), ++ 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), ++ 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), ### Fixes From 5820d0a9b68ead71d031377c5d22138675d7dfa8 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sat, 30 Apr 2022 00:13:01 +0000 Subject: [PATCH 03/15] fix: changelog correctly link to closed issues --- create_release.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/create_release.sh b/create_release.sh index 82ec4ae..5511264 100755 --- a/create_release.sh +++ b/create_release.sh @@ -105,7 +105,12 @@ update_release_body_and_changelog () { RELEASE_BODY_ADDITION="${DATE_SUBHEADING}$1" echo -e "${RELEASE_BODY_ADDITION}\n\nsee CHANGELOG.md for more details" > .github/release-body.md echo -e "# ${NEW_TAG_VERSION}\n${DATE_SUBHEADING}${CHANGELOG_ADDITION}$(cat CHANGELOG.md)" > CHANGELOG.md + + # Update changelog to add links to commits [hex x40] sed -i -E "s=(\s)\[([0-9a-f]{40})\](\n|\s|\,|\r)= [\2](${GIT_REPO_URL}/commit/\2),=g" ./CHANGELOG.md + + # Update changelog to add links to closed issues + sed -i -r -E "s=closes \[#([0-9]+)\],=[#\1](${GIT_REPO_URL}/issues/\1),=g" ./CHANGELOG.md } # update version in cargo.toml, to match selected current version/tag From 06bb13848ff5dae04af5531ca0b78180c1259c49 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sat, 30 Apr 2022 00:14:11 +0000 Subject: [PATCH 04/15] docs: changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a37a53..9e3a54c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### Fixes ++ create_release.sh correctly link to closed issues, [5820d0a9b68ead71d031377c5d22138675d7dfa8] + + # v0.0.2 ### 2022-04-29 From 32705a60c4f865eb829cc460b2ac82db79107c1a Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sat, 30 Apr 2022 00:45:06 +0000 Subject: [PATCH 05/15] refactor: generate_block() insert area in gui_state in generate_block, don't pass in currently selected panel, instead get from gui_state itself --- README.md | 3 +- src/ui/draw_blocks.rs | 73 ++++++++++++++++++++----------------------- src/ui/mod.rs | 4 --- 3 files changed, 35 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 8035554..525ab08 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

- A simple tui to view and control docker containers + A simple tui to view & control docker containers

@@ -55,7 +55,6 @@ available command line arguments requires docker & cross-rs - #### 64bit pi (pi 4, pi zero w 2) ```cross build --target aarch64-unknown-linux-gnu --release``` diff --git a/src/ui/draw_blocks.rs b/src/ui/draw_blocks.rs index 182462c..ae5828f 100644 --- a/src/ui/draw_blocks.rs +++ b/src/ui/draw_blocks.rs @@ -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, app_data: &Arc>, - selected_panel: &SelectablePanel, + area: Rect, + gui_state: &Arc>, + 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( f: &mut Frame<'_, B>, gui_state: &Arc>, index: Option, - 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,14 @@ pub fn draw_containers( area: Rect, f: &mut Frame<'_, B>, gui_state: &Arc>, - 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 +212,7 @@ pub fn draw_containers( } } -/// Draw the selectable panels +/// Draw the logs panels pub fn draw_logs( app_data: &Arc>, area: Rect, @@ -224,17 +220,16 @@ pub fn draw_logs( gui_state: &Arc>, index: Option, 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()) diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 15d04d2..144c86d 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -153,7 +153,6 @@ fn ui( 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(); @@ -197,7 +196,6 @@ fn ui( top_panel[0], f, gui_state, - &selected_panel, &column_widths, ); @@ -208,7 +206,6 @@ fn ui( f, gui_state, log_index, - &selected_panel, ); } @@ -219,7 +216,6 @@ fn ui( gui_state, log_index, loading_icon.to_owned(), - &selected_panel, ); draw_heading_bar( From defd54a22e5cab12c406a659abb2abe42683e9c4 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sat, 30 Apr 2022 00:47:27 +0000 Subject: [PATCH 06/15] docs: changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e3a54c..1dae939 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ ### Fixes + create_release.sh correctly link to closed issues, [5820d0a9b68ead71d031377c5d22138675d7dfa8] +### Refactors ++ generate_block reduce params, insert into area hashmap from inside said function, [32705a60c4f865eb829cc460b2ac82db79107c1a] + # v0.0.2 ### 2022-04-29 From a44689ee176c231f2c54fa9438c4abeb076af8d2 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Fri, 29 Apr 2022 21:41:31 -0400 Subject: [PATCH 07/15] docs: changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dae939..4fcde78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ + create_release.sh correctly link to closed issues, [5820d0a9b68ead71d031377c5d22138675d7dfa8] ### Refactors -+ generate_block reduce params, insert into area hashmap from inside said function, [32705a60c4f865eb829cc460b2ac82db79107c1a] ++ generate_block reduce params, insert into area hashmap from inside generate_block function, [32705a60c4f865eb829cc460b2ac82db79107c1a] # v0.0.2 From c04c34893207f613868c6a2ae4374d03de809197 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sun, 8 May 2022 15:57:28 +0000 Subject: [PATCH 08/15] refactor --- CHANGELOG.md | 14 +++++++------- create_release.sh | 5 ++++- src/ui/draw_blocks.rs | 27 +++++++++------------------ src/ui/mod.rs | 16 ++-------------- 4 files changed, 22 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fcde78..3a2a834 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,15 +9,15 @@ ### 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), # v0.0.1 ### 2022-04-25 diff --git a/create_release.sh b/create_release.sh index 5511264..35b981f 100755 --- a/create_release.sh +++ b/create_release.sh @@ -107,7 +107,10 @@ update_release_body_and_changelog () { echo -e "# ${NEW_TAG_VERSION}\n${DATE_SUBHEADING}${CHANGELOG_ADDITION}$(cat CHANGELOG.md)" > CHANGELOG.md # Update changelog to add links to commits [hex x40] - sed -i -E "s=(\s)\[([0-9a-f]{40})\](\n|\s|\,|\r)= [\2](${GIT_REPO_URL}/commit/\2),=g" ./CHANGELOG.md + # sed -i -E "s=(\s)\[([0-9a-f]{40})\](\n|\s|\,|\r)= [\2](${GIT_REPO_URL}/commit/\2),=g" ./CHANGELOG.md + + + 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 sed -i -r -E "s=closes \[#([0-9]+)\],=[#\1](${GIT_REPO_URL}/issues/\1),=g" ./CHANGELOG.md diff --git a/src/ui/draw_blocks.rs b/src/ui/draw_blocks.rs index ae5828f..eaeb134 100644 --- a/src/ui/draw_blocks.rs +++ b/src/ui/draw_blocks.rs @@ -23,15 +23,16 @@ use super::gui_state::BoxLocation; use super::{GuiState, SelectablePanel}; const NAME_TEXT: &str = r#" - 88 - 88 - 88 + 88 + 88 + 88 ,adPPYba, 8b, ,d8 88 ,d8 ,adPPYba, 8b,dPPYba, a8" "8a `Y8, ,8P' 88 ,a8" a8P_____88 88P' "Y8 -8b d8 )888( 8888[ 8PP""""""" 88 -"8a, ,a8" ,d8" "8b, 88`"Yba, "8b, ,aa 88 +8b d8 )888( 8888[ 8PP""""""" 88 +"8a, ,a8" ,d8" "8b, 88`"Yba, "8b, ,aa 88 `"YbbdP"' 8P' `Y8 88 `Y8a `"Ybbd8"' 88 "#; + const NAME: &str = env!("CARGO_PKG_NAME"); const VERSION: &str = env!("CARGO_PKG_VERSION"); const REPO: &str = env!("CARGO_PKG_REPOSITORY"); @@ -47,7 +48,7 @@ fn generate_block<'a>( gui_state: &Arc>, panel: SelectablePanel, ) -> Block<'a> { - gui_state.lock().insert_into_area_map(panel, area); + gui_state.lock().insert_into_area_map(panel, area); let mut block = Block::default() .borders(Borders::ALL) .border_type(BorderType::Rounded); @@ -122,12 +123,7 @@ pub fn draw_containers( gui_state: &Arc>, widths: &Columns, ) { - let block = generate_block( - app_data, - area, - gui_state, - SelectablePanel::Containers, - ); + let block = generate_block(app_data, area, gui_state, SelectablePanel::Containers); let items = app_data .lock() @@ -221,12 +217,7 @@ pub fn draw_logs( index: Option, loading_icon: String, ) { - let block = generate_block( - app_data, - area, - gui_state, - SelectablePanel::Logs, - ); + let block = generate_block(app_data, area, gui_state, SelectablePanel::Logs); let init = app_data.lock().init; if !init { diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 144c86d..fcec35d 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -191,22 +191,10 @@ fn ui( .constraints(lower_split.as_ref()) .split(upper_main[1]); - draw_containers( - app_data, - top_panel[0], - f, - gui_state, - &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, - ); + draw_commands(app_data, top_panel[1], f, gui_state, log_index); } draw_logs( From d30dabae50e1cd9ac617feb9e9df7d1f3e7c1a65 Mon Sep 17 00:00:00 2001 From: siph Date: Sun, 8 May 2022 11:37:14 -0600 Subject: [PATCH 09/15] feat: vim movement keys --- src/input_handler/mod.rs | 4 ++-- src/ui/draw_blocks.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/input_handler/mod.rs b/src/input_handler/mod.rs index 0dfead7..7461561 100644 --- a/src/input_handler/mod.rs +++ b/src/input_handler/mod.rs @@ -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() diff --git a/src/ui/draw_blocks.rs b/src/ui/draw_blocks.rs index 182462c..b880073 100644 --- a/src/ui/draw_blocks.rs +++ b/src/ui/draw_blocks.rs @@ -475,7 +475,7 @@ pub fn draw_help_box(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( From b44be5bab236812754ec741404b2ee1a2fea0aeb Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sun, 8 May 2022 18:08:41 +0000 Subject: [PATCH 10/15] docs: changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a2a834..4cdfa40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### Features ++ vim movement keys, 'j' & 'k', to move through menus, thanks [siph](https://github.com/siph), [77eb33c008e36965d84d1eafbbc3733af19fd262] + ### Fixes + create_release.sh correctly link to closed issues, [5820d0a9b68ead71d031377c5d22138675d7dfa8] From d20e1bcd47965859a04f8e080509a5afb2de36d9 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sun, 8 May 2022 18:16:25 +0000 Subject: [PATCH 11/15] refactor: dead code removed --- src/parse_args/mod.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/parse_args/mod.rs b/src/parse_args/mod.rs index 524da85..bae064a 100644 --- a/src/parse_args/mod.rs +++ b/src/parse_args/mod.rs @@ -15,10 +15,7 @@ pub struct CliArgs { #[clap(short = 'g')] pub gui: bool, - // /// Install to ./local/bin - // #[clap(short = 'i')] - // pub install: bool, - /// Remove timestamps from Docker logs + /// Remove timestamps from Docker logs #[clap(short = 't')] pub timestamp: bool, From eb9184a1aee64be1c20fabd482bfcbe676bed049 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sun, 8 May 2022 19:26:19 +0000 Subject: [PATCH 12/15] docs(README): slight tweaks --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 525ab08..082b1a0 100644 --- a/README.md +++ b/README.md @@ -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 | @@ -71,12 +71,6 @@ If no memory information available, try appending ```/boot/cmdline.txt``` with see https://forums.raspberrypi.com/viewtopic.php?t=203128 and https://github.com/docker/for-linux/issues/1112 -### Compress executable - -compress output from \~3mb to ~1mb - -```upx --best --lzma target/release/oxker -o ./oxker``` - ### Untested on other platforms ## Tests From 4283a285e2e60907e432294e3b97a759ec06a23d Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sun, 8 May 2022 19:26:55 +0000 Subject: [PATCH 13/15] refactor(create_release.sh): improve release flow & comments --- create_release.sh | 94 +++++++++++++++++++------------------------ src/parse_args/mod.rs | 2 +- 2 files changed, 43 insertions(+), 53 deletions(-) diff --git a/create_release.sh b/create_release.sh index 35b981f..b0cf666 100755 --- a/create_release.sh +++ b/create_release.sh @@ -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,33 +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 CHANGELOG.md for more details" > .github/release-body.md - echo -e "# ${NEW_TAG_VERSION}\n${DATE_SUBHEADING}${CHANGELOG_ADDITION}$(cat CHANGELOG.md)" > CHANGELOG.md - - # Update changelog to add links to commits [hex x40] - # 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 "# ${NEW_TAG_WITH_V}\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 - sed -i -r -E "s=closes \[#([0-9]+)\],=[#\1](${GIT_REPO_URL}/issues/\1),=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" @@ -135,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" @@ -176,39 +179,31 @@ 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 -} - +# COPY adsbdb # 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" @@ -218,10 +213,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=$? @@ -236,18 +230,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 diff --git a/src/parse_args/mod.rs b/src/parse_args/mod.rs index bae064a..aa5fb90 100644 --- a/src/parse_args/mod.rs +++ b/src/parse_args/mod.rs @@ -15,7 +15,7 @@ pub struct CliArgs { #[clap(short = 'g')] pub gui: bool, - /// Remove timestamps from Docker logs + /// Remove timestamps from Docker logs #[clap(short = 't')] pub timestamp: bool, From 251fea911566f7dcb656fae2477fb1fadb2bcb17 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sun, 8 May 2022 19:30:20 +0000 Subject: [PATCH 14/15] docs: changelog --- CHANGELOG.md | 5 +++++ create_release.sh | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cdfa40..6f5923d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### Docs ++ slight readme tweaks, [eb9184a1aee64be1c20fabd482bfcbe676bed049] + ### Features + vim movement keys, 'j' & 'k', to move through menus, thanks [siph](https://github.com/siph), [77eb33c008e36965d84d1eafbbc3733af19fd262] @@ -6,6 +9,8 @@ ### 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] # v0.0.2 diff --git a/create_release.sh b/create_release.sh index b0cf666..7b451ee 100755 --- a/create_release.sh +++ b/create_release.sh @@ -179,7 +179,6 @@ cargo_test () { ask_continue } -# COPY adsbdb # Full flow to create a new release release_flow() { check_git From cb72b9c3288b73eb70e62411324f327a1801641f Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sun, 8 May 2022 19:30:42 +0000 Subject: [PATCH 15/15] chore: release v0.0.3 --- .github/release-body.md | 20 ++++++++++++-------- CHANGELOG.md | 15 +++++++++------ Cargo.toml | 2 +- src/input_handler/mod.rs | 2 +- src/ui/draw_blocks.rs | 1 - 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/.github/release-body.md b/.github/release-body.md index b689008..f907252 100644 --- a/.github/release-body.md +++ b/.github/release-body.md @@ -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 CHANGELOG.md for more details diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f5923d..5b8ae1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,19 @@ +# v0.0.3 +### 2022-05-08 + ### Docs -+ slight readme tweaks, [eb9184a1aee64be1c20fabd482bfcbe676bed049] ++ 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), [77eb33c008e36965d84d1eafbbc3733af19fd262] ++ 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, [5820d0a9b68ead71d031377c5d22138675d7dfa8] ++ 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, [32705a60c4f865eb829cc460b2ac82db79107c1a] -+ dead code removed, [d20e1bcd47965859a04f8e080509a5afb2de36d9] -+ create_release.sh improved flow & comments, [4283a285e2e60907e432294e3b97a759ec06a23d] ++ 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), # v0.0.2 diff --git a/Cargo.toml b/Cargo.toml index e69da58..0b77d12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oxker" -version = "0.0.2" +version = "0.0.3" edition = "2021" authors = ["Jack Wills "] description = "a simple tui to view & control docker containers" diff --git a/src/input_handler/mod.rs b/src/input_handler/mod.rs index 7461561..f0b90e8 100644 --- a/src/input_handler/mod.rs +++ b/src/input_handler/mod.rs @@ -164,7 +164,7 @@ impl InputHandler { self.previous() } } - KeyCode::Down | KeyCode::Char('j')=> self.next(), + KeyCode::Down | KeyCode::Char('j') => self.next(), KeyCode::PageDown => { for _ in 0..=6 { self.next() diff --git a/src/ui/draw_blocks.rs b/src/ui/draw_blocks.rs index d904945..f11fe0c 100644 --- a/src/ui/draw_blocks.rs +++ b/src/ui/draw_blocks.rs @@ -32,7 +32,6 @@ a8" "8a `Y8, ,8P' 88 ,a8" a8P_____88 88P' "Y8 "8a, ,a8" ,d8" "8b, 88`"Yba, "8b, ,aa 88 `"YbbdP"' 8P' `Y8 88 `Y8a `"Ybbd8"' 88 "#; - const NAME: &str = env!("CARGO_PKG_NAME"); const VERSION: &str = env!("CARGO_PKG_VERSION"); const REPO: &str = env!("CARGO_PKG_REPOSITORY");