chore: merge release-v0.0.3 into main
This commit is contained in:
+12
-8
@@ -1,15 +1,19 @@
|
|||||||
### 2022-04-29
|
### 2022-05-08
|
||||||
|
|
||||||
|
### Docs
|
||||||
|
+ slight readme tweaks, [eb9184a1aee64be1c20fabd482bfcbe676bed049]
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
+ allow toggling of mouse caputre, to select & copy text with mouse, closes [#2], [aec184ea22b289e91942a4c3e6a415685884bc47]
|
+ vim movement keys, 'j' & 'k', to move through menus, thanks [siph](https://github.com/siph), [77eb33c008e36965d84d1eafbbc3733af19fd262]
|
||||||
+ 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]
|
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
+ readme.md typo, [589501f9a4a0bfabdb0654e68cc0c752c529d97a]
|
+ create_release.sh correctly link to closed issues, [5820d0a9b68ead71d031377c5d22138675d7dfa8]
|
||||||
+ column heading mem > memory, [5e8e6b590b06f01a542fdd10bae8f14d303ab08a]
|
|
||||||
+ cargo fmt added to create_release.sh, [bb29c0ebfafd6a9a036eb317a240954d1405966e]
|
### 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
|
see <a href='https://github.com/mrjackwills/oxker/blob/main/CHANGELOG.md'>CHANGELOG.md</a> for more details
|
||||||
|
|||||||
+25
-7
@@ -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>
|
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.0.2'>v0.0.2</a>
|
||||||
### 2022-04-29
|
### 2022-04-29
|
||||||
|
|
||||||
### Features
|
### 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, [aec184ea](https://github.com/mrjackwills/oxker/commit/aec184ea22b289e91942a4c3e6a415685884bc47),
|
||||||
+ show id column, [b10f927481c9e38a48c1d4b94e744ec48e8b6ba6](https://github.com/mrjackwills/oxker/commit/b10f927481c9e38a48c1d4b94e744ec48e8b6ba6),
|
+ show id column, [b10f9274](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, [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, [9b70fdfad7b38361ebee301bdc2545d3f0dfcf9e](https://github.com/mrjackwills/oxker/commit/9b70fdfad7b38361ebee301bdc2545d3f0dfcf9e),
|
+ 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
|
### Fixes
|
||||||
+ readme.md typo, [589501f9a4a0bfabdb0654e68cc0c752c529d97a](https://github.com/mrjackwills/oxker/commit/589501f9a4a0bfabdb0654e68cc0c752c529d97a),
|
+ readme.md typo, [589501f9](https://github.com/mrjackwills/oxker/commit/589501f9a4a0bfabdb0654e68cc0c752c529d97a),
|
||||||
+ column heading mem > memory, [5e8e6b590b06f01a542fdd10bae8f14d303ab08a](https://github.com/mrjackwills/oxker/commit/5e8e6b590b06f01a542fdd10bae8f14d303ab08a),
|
+ column heading mem > memory, [5e8e6b59](https://github.com/mrjackwills/oxker/commit/5e8e6b590b06f01a542fdd10bae8f14d303ab08a),
|
||||||
+ cargo fmt added to create_release.sh, [bb29c0ebfafd6a9a036eb317a240954d1405966e](https://github.com/mrjackwills/oxker/commit/bb29c0ebfafd6a9a036eb317a240954d1405966e),
|
+ 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>
|
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.0.1'>v0.0.1</a>
|
||||||
### 2022-04-25
|
### 2022-04-25
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "oxker"
|
name = "oxker"
|
||||||
version = "0.0.2"
|
version = "0.0.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Jack Wills <email@mrjackwills.com>"]
|
authors = ["Jack Wills <email@mrjackwills.com>"]
|
||||||
description = "a simple tui to view & control docker containers"
|
description = "a simple tui to view & control docker containers"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
A simple tui to view and control docker containers
|
A simple tui to view & control docker containers
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@@ -39,7 +39,7 @@ rm oxker_linux_x86_64.tar.gz oxker
|
|||||||
available command line arguments
|
available command line arguments
|
||||||
| argument|result|
|
| 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) |
|
|```-r```| Show raw logs, by default oxker will remove ANSI formatting (conflicts with -c) |
|
||||||
|```-c```| Attempt to color the logs (conflicts with -r) |
|
|```-c```| Attempt to color the logs (conflicts with -r) |
|
||||||
|```-t```| Remove timestamps from each log entry |
|
|```-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>
|
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)
|
#### 64bit pi (pi 4, pi zero w 2)
|
||||||
|
|
||||||
```cross build --target aarch64-unknown-linux-gnu --release```
|
```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>
|
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
|
### Untested on other platforms
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|||||||
+45
-48
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# rust create_release
|
# rust create_release
|
||||||
# v0.0.14
|
# v0.0.15
|
||||||
|
|
||||||
PACKAGE_NAME='oxker'
|
PACKAGE_NAME='oxker'
|
||||||
STAR_LINE='****************************************'
|
STAR_LINE='****************************************'
|
||||||
@@ -20,7 +20,6 @@ error_close() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ -z "$PACKAGE_NAME" ]
|
if [ -z "$PACKAGE_NAME" ]
|
||||||
then
|
then
|
||||||
error_close "No package name"
|
error_close "No package name"
|
||||||
@@ -96,25 +95,37 @@ ask_changelog_update() {
|
|||||||
fi
|
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
|
# add commit urls to changelog
|
||||||
# $1 RELEASE_BODY
|
# $1 RELEASE_BODY
|
||||||
update_release_body_and_changelog () {
|
update_release_body_and_changelog () {
|
||||||
echo -e
|
echo -e
|
||||||
DATE_SUBHEADING="### $(date +'%Y-%m-%d')\n\n"
|
DATE_SUBHEADING="### $(date +'%Y-%m-%d')\n\n"
|
||||||
RELEASE_BODY_ADDITION="${DATE_SUBHEADING}$1"
|
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 "${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 version in cargo.toml, to match selected current version
|
||||||
update_cargo_toml () {
|
update_version_number_in_files () {
|
||||||
sed -i "s|^version = .*|version = \"${NEW_TAG_VERSION:1}\"|" Cargo.toml
|
sed -i "s|^version = .*|version = \"${MAJOR}.${MINOR}.${PATCH}\"|" Cargo.toml
|
||||||
}
|
}
|
||||||
|
|
||||||
# Work out the current version, based on git tags
|
# Work out the current version, based on git tags
|
||||||
# create new semver version based on user input
|
# create new semver version based on user input
|
||||||
|
# Set MAJOR MINOR PATCH
|
||||||
check_tag () {
|
check_tag () {
|
||||||
LATEST_TAG=$(git describe --tags --abbrev=0 --always)
|
LATEST_TAG=$(git describe --tags --abbrev=0 --always)
|
||||||
echo -e "\nCurrent tag: ${PURPLE}${LATEST_TAG}${RESET}\n"
|
echo -e "\nCurrent tag: ${PURPLE}${LATEST_TAG}${RESET}\n"
|
||||||
@@ -127,24 +138,24 @@ check_tag () {
|
|||||||
MINOR="0"
|
MINOR="0"
|
||||||
PATCH="0"
|
PATCH="0"
|
||||||
fi
|
fi
|
||||||
MAJOR_TAG=v$(update_major)
|
OP_MAJOR="major___v$(update_major)"
|
||||||
MINOR_TAG=v$(update_minor)
|
OP_MINOR="minor___v$(update_minor)"
|
||||||
PATCH_TAG=v$(update_patch)
|
OP_PATCH="patch___v$(update_patch)"
|
||||||
OP_MAJOR="major___$MAJOR_TAG"
|
|
||||||
OP_MINOR="minor___$MINOR_TAG"
|
|
||||||
OP_PATCH="patch___$PATCH_TAG"
|
|
||||||
OPTIONS=("$OP_MAJOR" "$OP_MINOR" "$OP_PATCH")
|
OPTIONS=("$OP_MAJOR" "$OP_MINOR" "$OP_PATCH")
|
||||||
select choice in "${OPTIONS[@]}"
|
select choice in "${OPTIONS[@]}"
|
||||||
do
|
do
|
||||||
case $choice in
|
case $choice in
|
||||||
"$OP_MAJOR" )
|
"$OP_MAJOR" )
|
||||||
NEW_TAG_VERSION="$MAJOR_TAG"
|
MAJOR=$((MAJOR + 1))
|
||||||
|
MINOR=0
|
||||||
|
PATCH=0
|
||||||
break;;
|
break;;
|
||||||
"$OP_MINOR")
|
"$OP_MINOR")
|
||||||
NEW_TAG_VERSION="$MINOR_TAG"
|
MINOR=$((MINOR + 1))
|
||||||
|
PATCH=0
|
||||||
break;;
|
break;;
|
||||||
"$OP_PATCH")
|
"$OP_PATCH")
|
||||||
NEW_TAG_VERSION="$PATCH_TAG"
|
PATCH=$((PATCH + 1))
|
||||||
break;;
|
break;;
|
||||||
*)
|
*)
|
||||||
error_close "invalid option $REPLY"
|
error_close "invalid option $REPLY"
|
||||||
@@ -168,39 +179,30 @@ cargo_test () {
|
|||||||
ask_continue
|
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
|
# Full flow to create a new release
|
||||||
release_flow() {
|
release_flow() {
|
||||||
check_git
|
check_git
|
||||||
get_git_remote_url
|
get_git_remote_url
|
||||||
|
cargo fmt
|
||||||
cargo_test
|
cargo_test
|
||||||
cd "${CWD}" || error_close "Can't find ${CWD}"
|
cd "${CWD}" || error_close "Can't find ${CWD}"
|
||||||
check_tag
|
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
|
echo -e
|
||||||
ask_changelog_update
|
ask_changelog_update
|
||||||
git checkout -b "$RELEASE_BRANCH"
|
git checkout -b "$RELEASE_BRANCH"
|
||||||
update_cargo_toml
|
update_version_number_in_files
|
||||||
cargo fmt
|
|
||||||
git add .
|
git add .
|
||||||
git commit -m "chore: release $NEW_TAG_VERSION"
|
git commit -m "chore: release $NEW_TAG_WITH_V"
|
||||||
|
|
||||||
git checkout main
|
git checkout main
|
||||||
git merge --no-ff "$RELEASE_BRANCH" -m "chore: merge ${RELEASE_BRANCH} into main"
|
git merge --no-ff "$RELEASE_BRANCH" -m "chore: merge ${RELEASE_BRANCH} into main"
|
||||||
git tag -am "${RELEASE_BRANCH}" "$NEW_TAG_VERSION"
|
git tag -am "${RELEASE_BRANCH}" "$NEW_TAG_WITH_V"
|
||||||
echo "git tag -am \"${RELEASE_BRANCH}\" \"$NEW_TAG_VERSION\""
|
echo "git tag -am \"${RELEASE_BRANCH}\" \"$NEW_TAG_WITH_V\""
|
||||||
git push --atomic origin main "$NEW_TAG_VERSION"
|
git push --atomic origin main "$NEW_TAG_WITH_V"
|
||||||
git checkout dev
|
git checkout dev
|
||||||
git merge --no-ff main -m 'chore: merge main into dev'
|
git merge --no-ff main -m 'chore: merge main into dev'
|
||||||
git branch -d "$RELEASE_BRANCH"
|
git branch -d "$RELEASE_BRANCH"
|
||||||
@@ -210,10 +212,9 @@ release_flow() {
|
|||||||
main() {
|
main() {
|
||||||
cmd=(dialog --backtitle "Choose build option" --radiolist "choose" 14 80 16)
|
cmd=(dialog --backtitle "Choose build option" --radiolist "choose" 14 80 16)
|
||||||
options=(
|
options=(
|
||||||
1 "fmt" off
|
1 "build" off
|
||||||
2 "build" off
|
2 "test" off
|
||||||
3 "test" off
|
3 "release" off
|
||||||
4 "release" off
|
|
||||||
)
|
)
|
||||||
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
|
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
|
||||||
exitStatus=$?
|
exitStatus=$?
|
||||||
@@ -228,18 +229,14 @@ main() {
|
|||||||
exit
|
exit
|
||||||
break;;
|
break;;
|
||||||
1)
|
1)
|
||||||
cargo fmt
|
|
||||||
main
|
|
||||||
break;;
|
|
||||||
2)
|
|
||||||
cargo_build_all
|
cargo_build_all
|
||||||
main
|
main
|
||||||
break;;
|
break;;
|
||||||
3)
|
2)
|
||||||
npm_test
|
cargo_test
|
||||||
main
|
main
|
||||||
break;;
|
break;;
|
||||||
4)
|
3)
|
||||||
release_flow
|
release_flow
|
||||||
break;;
|
break;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -158,13 +158,13 @@ impl InputHandler {
|
|||||||
SelectablePanel::Commands => locked_data.docker_command_end(),
|
SelectablePanel::Commands => locked_data.docker_command_end(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeyCode::Up => self.previous(),
|
KeyCode::Up | KeyCode::Char('k') => self.previous(),
|
||||||
KeyCode::PageUp => {
|
KeyCode::PageUp => {
|
||||||
for _ in 0..=6 {
|
for _ in 0..=6 {
|
||||||
self.previous()
|
self.previous()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
KeyCode::Down => self.next(),
|
KeyCode::Down | KeyCode::Char('j') => self.next(),
|
||||||
KeyCode::PageDown => {
|
KeyCode::PageDown => {
|
||||||
for _ in 0..=6 {
|
for _ in 0..=6 {
|
||||||
self.next()
|
self.next()
|
||||||
|
|||||||
@@ -15,9 +15,6 @@ pub struct CliArgs {
|
|||||||
#[clap(short = 'g')]
|
#[clap(short = 'g')]
|
||||||
pub gui: bool,
|
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')]
|
#[clap(short = 't')]
|
||||||
pub timestamp: bool,
|
pub timestamp: bool,
|
||||||
|
|||||||
+30
-45
@@ -23,13 +23,13 @@ use super::gui_state::BoxLocation;
|
|||||||
use super::{GuiState, SelectablePanel};
|
use super::{GuiState, SelectablePanel};
|
||||||
|
|
||||||
const NAME_TEXT: &str = r#"
|
const NAME_TEXT: &str = r#"
|
||||||
88
|
88
|
||||||
88
|
88
|
||||||
88
|
88
|
||||||
,adPPYba, 8b, ,d8 88 ,d8 ,adPPYba, 8b,dPPYba,
|
,adPPYba, 8b, ,d8 88 ,d8 ,adPPYba, 8b,dPPYba,
|
||||||
a8" "8a `Y8, ,8P' 88 ,a8" a8P_____88 88P' "Y8
|
a8" "8a `Y8, ,8P' 88 ,a8" a8P_____88 88P' "Y8
|
||||||
8b d8 )888( 8888[ 8PP""""""" 88
|
8b d8 )888( 8888[ 8PP""""""" 88
|
||||||
"8a, ,a8" ,d8" "8b, 88`"Yba, "8b, ,aa 88
|
"8a, ,a8" ,d8" "8b, 88`"Yba, "8b, ,aa 88
|
||||||
`"YbbdP"' 8P' `Y8 88 `Y8a `"Ybbd8"' 88 "#;
|
`"YbbdP"' 8P' `Y8 88 `Y8a `"Ybbd8"' 88 "#;
|
||||||
|
|
||||||
const NAME: &str = env!("CARGO_PKG_NAME");
|
const NAME: &str = env!("CARGO_PKG_NAME");
|
||||||
@@ -42,32 +42,32 @@ const MARGIN: &str = " ";
|
|||||||
/// Generate block, add a border if is the selected panel,
|
/// Generate block, add a border if is the selected panel,
|
||||||
/// add custom title based on state of each panel
|
/// add custom title based on state of each panel
|
||||||
fn generate_block<'a>(
|
fn generate_block<'a>(
|
||||||
selectable_panel: Option<SelectablePanel>,
|
|
||||||
app_data: &Arc<Mutex<AppData>>,
|
app_data: &Arc<Mutex<AppData>>,
|
||||||
selected_panel: &SelectablePanel,
|
area: Rect,
|
||||||
|
gui_state: &Arc<Mutex<GuiState>>,
|
||||||
|
panel: SelectablePanel,
|
||||||
) -> Block<'a> {
|
) -> Block<'a> {
|
||||||
|
gui_state.lock().insert_into_area_map(panel, area);
|
||||||
let mut block = Block::default()
|
let mut block = Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_type(BorderType::Rounded);
|
.border_type(BorderType::Rounded);
|
||||||
|
let current_selected_panel = gui_state.lock().selected_panel;
|
||||||
if let Some(panel) = selectable_panel {
|
let title = match panel {
|
||||||
let title = match panel {
|
SelectablePanel::Containers => {
|
||||||
SelectablePanel::Containers => {
|
format!(
|
||||||
format!(
|
" {} {} ",
|
||||||
" {} {} ",
|
panel.title(),
|
||||||
panel.title(),
|
app_data.lock().containers.get_state_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));
|
|
||||||
}
|
}
|
||||||
|
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
|
block
|
||||||
}
|
}
|
||||||
@@ -79,13 +79,8 @@ pub fn draw_commands<B: Backend>(
|
|||||||
f: &mut Frame<'_, B>,
|
f: &mut Frame<'_, B>,
|
||||||
gui_state: &Arc<Mutex<GuiState>>,
|
gui_state: &Arc<Mutex<GuiState>>,
|
||||||
index: Option<usize>,
|
index: Option<usize>,
|
||||||
selected_panel: &SelectablePanel,
|
|
||||||
) {
|
) {
|
||||||
let panel = SelectablePanel::Commands;
|
let block = generate_block(app_data, area, gui_state, SelectablePanel::Commands);
|
||||||
let block = generate_block(Some(panel), app_data, selected_panel);
|
|
||||||
|
|
||||||
gui_state.lock().insert_into_area_map(panel, area);
|
|
||||||
|
|
||||||
if let Some(i) = index {
|
if let Some(i) = index {
|
||||||
let items = app_data.lock().containers.items[i]
|
let items = app_data.lock().containers.items[i]
|
||||||
.docker_controls
|
.docker_controls
|
||||||
@@ -125,13 +120,9 @@ pub fn draw_containers<B: Backend>(
|
|||||||
area: Rect,
|
area: Rect,
|
||||||
f: &mut Frame<'_, B>,
|
f: &mut Frame<'_, B>,
|
||||||
gui_state: &Arc<Mutex<GuiState>>,
|
gui_state: &Arc<Mutex<GuiState>>,
|
||||||
selected_panel: &SelectablePanel,
|
|
||||||
widths: &Columns,
|
widths: &Columns,
|
||||||
) {
|
) {
|
||||||
let panel = SelectablePanel::Containers;
|
let block = generate_block(app_data, area, gui_state, SelectablePanel::Containers);
|
||||||
let block = generate_block(Some(panel), app_data, selected_panel);
|
|
||||||
|
|
||||||
gui_state.lock().insert_into_area_map(panel, area);
|
|
||||||
|
|
||||||
let items = app_data
|
let items = app_data
|
||||||
.lock()
|
.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>(
|
pub fn draw_logs<B: Backend>(
|
||||||
app_data: &Arc<Mutex<AppData>>,
|
app_data: &Arc<Mutex<AppData>>,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
@@ -224,17 +215,11 @@ pub fn draw_logs<B: Backend>(
|
|||||||
gui_state: &Arc<Mutex<GuiState>>,
|
gui_state: &Arc<Mutex<GuiState>>,
|
||||||
index: Option<usize>,
|
index: Option<usize>,
|
||||||
loading_icon: String,
|
loading_icon: String,
|
||||||
selected_panel: &SelectablePanel,
|
|
||||||
) {
|
) {
|
||||||
let panel = SelectablePanel::Logs;
|
let block = generate_block(app_data, area, gui_state, SelectablePanel::Logs);
|
||||||
|
|
||||||
gui_state.lock().insert_into_area_map(panel, area);
|
|
||||||
|
|
||||||
let block = generate_block(Some(panel), app_data, selected_panel);
|
|
||||||
|
|
||||||
let init = app_data.lock().init;
|
let init = app_data.lock().init;
|
||||||
if !init {
|
if !init {
|
||||||
// let icon = gui_state.lock().get_loading();
|
|
||||||
let parsing_logs = format!("parsing logs {}", loading_icon);
|
let parsing_logs = format!("parsing logs {}", loading_icon);
|
||||||
let paragraph = Paragraph::new(parsing_logs)
|
let paragraph = Paragraph::new(parsing_logs)
|
||||||
.style(Style::default())
|
.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 description_text = format!("\n{}", DESCRIPTION);
|
||||||
|
|
||||||
let mut help_text = String::from("\n ( tab ) or ( alt+tab ) to change panels");
|
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 ( enter ) to send docker container commands");
|
||||||
help_text.push_str("\n ( h ) to toggle this help information");
|
help_text.push_str("\n ( h ) to toggle this help information");
|
||||||
help_text.push_str(
|
help_text.push_str(
|
||||||
|
|||||||
+2
-18
@@ -153,7 +153,6 @@ fn ui<B: Backend>(
|
|||||||
let has_containers = !app_data.lock().containers.items.is_empty();
|
let has_containers = !app_data.lock().containers.items.is_empty();
|
||||||
let has_error = app_data.lock().get_error();
|
let has_error = app_data.lock().get_error();
|
||||||
let log_index = app_data.lock().get_selected_log_index();
|
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 show_help = gui_state.lock().show_help;
|
||||||
let info_text = gui_state.lock().info_box_text.clone();
|
let info_text = gui_state.lock().info_box_text.clone();
|
||||||
let loading_icon = gui_state.lock().get_loading();
|
let loading_icon = gui_state.lock().get_loading();
|
||||||
@@ -192,24 +191,10 @@ fn ui<B: Backend>(
|
|||||||
.constraints(lower_split.as_ref())
|
.constraints(lower_split.as_ref())
|
||||||
.split(upper_main[1]);
|
.split(upper_main[1]);
|
||||||
|
|
||||||
draw_containers(
|
draw_containers(app_data, top_panel[0], f, gui_state, &column_widths);
|
||||||
app_data,
|
|
||||||
top_panel[0],
|
|
||||||
f,
|
|
||||||
gui_state,
|
|
||||||
&selected_panel,
|
|
||||||
&column_widths,
|
|
||||||
);
|
|
||||||
|
|
||||||
if has_containers {
|
if has_containers {
|
||||||
draw_commands(
|
draw_commands(app_data, top_panel[1], f, gui_state, log_index);
|
||||||
app_data,
|
|
||||||
top_panel[1],
|
|
||||||
f,
|
|
||||||
gui_state,
|
|
||||||
log_index,
|
|
||||||
&selected_panel,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_logs(
|
draw_logs(
|
||||||
@@ -219,7 +204,6 @@ fn ui<B: Backend>(
|
|||||||
gui_state,
|
gui_state,
|
||||||
log_index,
|
log_index,
|
||||||
loading_icon.to_owned(),
|
loading_icon.to_owned(),
|
||||||
&selected_panel,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
draw_heading_bar(
|
draw_heading_bar(
|
||||||
|
|||||||
Reference in New Issue
Block a user