diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index ece3b05..871131d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -6,7 +6,6 @@
# - https://github.com/motemen/hwatch/blob/97d3745dcc8931a1d75217573d5ca60705be632f/.github/workflows/release.yml
# - https://github.com/greymd/teip/blob/master/.github/workflows/release.yml
-
name: Release Job.
on:
@@ -14,7 +13,7 @@ on:
branches:
- master
paths-ignore:
- - '**/README.md'
+ - "**/README.md"
jobs:
# build rust binary
@@ -40,9 +39,9 @@ jobs:
- target: aarch64-apple-darwin
os: macos-latest
ext: tar.gz
- # - target: x86_64-pc-windows-gnu
- # os: ubuntu-latest
- # ext: zip
+ - target: x86_64-pc-windows-gnu
+ os: ubuntu-latest
+ ext: zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
@@ -105,6 +104,12 @@ jobs:
perl -i -pe s/___VERSION___/${{ steps.package_version.outputs.version }}/ ./package/.tar2package.yml
tar czvf "$_TAR" -C "$PWD/package" completion bin man .tar2package.yml
+ - name: Create package file
+ if: ${{ (matrix.ext == 'zip') }}
+ run: |
+ _ZIP=hwatch-${{ steps.package_version.outputs.version }}.${{ matrix.target }}.zip
+ 7z a "$_ZIP" target/${{ matrix.target }}/release/hwatch.exe
+
# use: https://github.com/greymd/tar2package
- name: Build rpm
id: rpm
@@ -154,6 +159,13 @@ jobs:
name: build-${{ matrix.target }}
path: hwatch-${{ steps.package_version.outputs.version }}.${{ matrix.target }}.tar.gz
+ - name: Upload artifact
+ if: matrix.ext == 'zip'
+ uses: actions/upload-artifact@v1
+ with:
+ name: build-${{ matrix.target }}
+ path: hwatch-${{ steps.package_version.outputs.version }}.${{ matrix.target }}.zip
+
# create package release
create-release:
needs:
@@ -211,7 +223,9 @@ jobs:
- target: aarch64-apple-darwin
os: macos-latest
ext: tar.gz
- # - x86_64-pc-windows-gnu
+ - target: x86_64-pc-windows-gnu
+ os: ubuntu-latest
+ ext: zip
needs: [create-release]
runs-on: ubuntu-latest
steps:
diff --git a/Cargo.lock b/Cargo.lock
index 9c78e02..f9eeed9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,12 @@
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
[[package]]
name = "ahash"
version = "0.8.11"
@@ -46,9 +52,9 @@ dependencies = [
[[package]]
name = "ansi-parser"
-version = "0.9.0"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fad5bd94a775101bd68c2de2bb28ca2eccd69f395ae3aec4ac4f6da3c1cd2c6a"
+checksum = "c43e7fd8284f025d0bd143c2855618ecdf697db55bde39211e5c9faec7669173"
dependencies = [
"heapless",
"nom",
@@ -117,18 +123,6 @@ version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1"
-[[package]]
-name = "as-slice"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45403b49e3954a4b8428a0ac21a4b7afadccf92bfd96273f1a58cd4812496ae0"
-dependencies = [
- "generic-array 0.12.4",
- "generic-array 0.13.3",
- "generic-array 0.14.5",
- "stable_deref_trait",
-]
-
[[package]]
name = "async-channel"
version = "1.6.1"
@@ -286,7 +280,7 @@ version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
- "generic-array 0.14.5",
+ "generic-array",
]
[[package]]
@@ -303,6 +297,17 @@ dependencies = [
"once_cell",
]
+[[package]]
+name = "bstr"
+version = "0.2.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
+dependencies = [
+ "lazy_static",
+ "memchr",
+ "regex-automata 0.1.10",
+]
+
[[package]]
name = "bumpalo"
version = "3.10.0"
@@ -338,9 +343,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.0.89"
+version = "1.0.97"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723"
+checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4"
[[package]]
name = "cfg-if"
@@ -348,6 +353,17 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+[[package]]
+name = "chardetng"
+version = "0.1.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "14b8f0b65b7b08ae3c8187e8d77174de20cb6777864c6b832d8ad365999cf1ea"
+dependencies = [
+ "cfg-if",
+ "encoding_rs",
+ "memchr",
+]
+
[[package]]
name = "chrono"
version = "0.4.34"
@@ -417,6 +433,39 @@ dependencies = [
"cache-padded",
]
+[[package]]
+name = "config"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7328b20597b53c2454f0b1919720c25c7339051c02b72b7e05409e00b14132be"
+dependencies = [
+ "lazy_static",
+ "nom",
+ "pathdiff",
+ "rust-ini",
+ "serde",
+]
+
+[[package]]
+name = "const-random"
+version = "0.1.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
+dependencies = [
+ "const-random-macro",
+]
+
+[[package]]
+name = "const-random-macro"
+version = "0.1.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
+dependencies = [
+ "getrandom",
+ "once_cell",
+ "tiny-keccak",
+]
+
[[package]]
name = "core-foundation-sys"
version = "0.8.6"
@@ -432,6 +481,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "crc32fast"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
+dependencies = [
+ "cfg-if",
+]
+
[[package]]
name = "crossbeam-channel"
version = "0.5.12"
@@ -472,13 +530,19 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "crunchy"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
+
[[package]]
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
- "generic-array 0.14.5",
+ "generic-array",
"typenum",
]
@@ -518,12 +582,6 @@ version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5729f5117e208430e437df2f4843f5e5952997175992d1414f94c57d61e270b4"
-[[package]]
-name = "difference"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
-
[[package]]
name = "digest"
version = "0.10.7"
@@ -554,12 +612,30 @@ dependencies = [
"winapi",
]
+[[package]]
+name = "dlv-list"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "442039f5147480ba31067cb00ada1adae6892028e40e45fc5de7b7df6dcc1b5f"
+dependencies = [
+ "const-random",
+]
+
[[package]]
name = "either"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
+[[package]]
+name = "encoding_rs"
+version = "0.8.34"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
+dependencies = [
+ "cfg-if",
+]
+
[[package]]
name = "errno"
version = "0.3.8"
@@ -570,6 +646,16 @@ dependencies = [
"windows-sys 0.52.0",
]
+[[package]]
+name = "error-stack"
+version = "0.4.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "27a72baa257b5e0e2de241967bc5ee8f855d6072351042688621081d66b2a76b"
+dependencies = [
+ "anyhow",
+ "rustc_version",
+]
+
[[package]]
name = "euclid"
version = "0.22.9"
@@ -633,6 +719,16 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
+[[package]]
+name = "flate2"
+version = "1.0.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
+dependencies = [
+ "crc32fast",
+ "miniz_oxide",
+]
+
[[package]]
name = "fnv"
version = "1.0.7"
@@ -743,24 +839,6 @@ dependencies = [
"slab",
]
-[[package]]
-name = "generic-array"
-version = "0.12.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
-dependencies = [
- "typenum",
-]
-
-[[package]]
-name = "generic-array"
-version = "0.13.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309"
-dependencies = [
- "typenum",
-]
-
[[package]]
name = "generic-array"
version = "0.14.5"
@@ -796,13 +874,19 @@ dependencies = [
[[package]]
name = "hash32"
-version = "0.1.1"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4041af86e63ac4298ce40e5cca669066e75b6f1aa3390fe2561ffa5e1d9f4cc"
+checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
dependencies = [
"byteorder",
]
+[[package]]
+name = "hashbrown"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
+
[[package]]
name = "hashbrown"
version = "0.14.3"
@@ -815,12 +899,10 @@ dependencies = [
[[package]]
name = "heapless"
-version = "0.6.1"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "634bd4d29cbf24424d0a4bfcbf80c6960129dc24424752a7d1d1390607023422"
+checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
dependencies = [
- "as-slice",
- "generic-array 0.14.5",
"hash32",
"stable_deref_trait",
]
@@ -839,17 +921,21 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "hwatch"
-version = "0.3.13"
+version = "0.3.14"
dependencies = [
"ansi-parser",
"ansi_term",
"async-std",
+ "chardetng",
"chrono",
"clap",
+ "config",
"crossbeam-channel",
"crossterm",
"ctrlc",
- "difference",
+ "encoding_rs",
+ "error-stack",
+ "flate2",
"futures",
"heapless",
"question",
@@ -859,6 +945,7 @@ dependencies = [
"serde_derive",
"serde_json",
"shell-words",
+ "similar",
"termwiz",
]
@@ -994,7 +1081,7 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc"
dependencies = [
- "hashbrown",
+ "hashbrown 0.14.3",
]
[[package]]
@@ -1043,6 +1130,15 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+[[package]]
+name = "miniz_oxide"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae"
+dependencies = [
+ "adler",
+]
+
[[package]]
name = "mio"
version = "0.8.3"
@@ -1137,6 +1233,16 @@ dependencies = [
"num-traits",
]
+[[package]]
+name = "ordered-multimap"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ed8acf08e98e744e5384c8bc63ceb0364e68a6854187221c18df61c4797690e"
+dependencies = [
+ "dlv-list",
+ "hashbrown 0.13.2",
+]
+
[[package]]
name = "parking"
version = "2.0.0"
@@ -1172,6 +1278,12 @@ version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
+[[package]]
+name = "pathdiff"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
+
[[package]]
name = "pest"
version = "2.7.8"
@@ -1390,10 +1502,16 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
dependencies = [
"aho-corasick",
"memchr",
- "regex-automata",
+ "regex-automata 0.4.6",
"regex-syntax",
]
+[[package]]
+name = "regex-automata"
+version = "0.1.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
+
[[package]]
name = "regex-automata"
version = "0.4.6"
@@ -1411,6 +1529,25 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
+[[package]]
+name = "rust-ini"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e2a3bcec1f113553ef1c88aae6c020a369d03d55b58de9869a0908930385091"
+dependencies = [
+ "cfg-if",
+ "ordered-multimap",
+]
+
+[[package]]
+name = "rustc_version"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
+dependencies = [
+ "semver 1.0.23",
+]
+
[[package]]
name = "rustix"
version = "0.38.31"
@@ -1451,6 +1588,12 @@ dependencies = [
"semver-parser",
]
+[[package]]
+name = "semver"
+version = "1.0.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
+
[[package]]
name = "semver-parser"
version = "0.10.2"
@@ -1538,6 +1681,17 @@ dependencies = [
"libc",
]
+[[package]]
+name = "similar"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640"
+dependencies = [
+ "bstr",
+ "serde",
+ "unicode-segmentation",
+]
+
[[package]]
name = "siphasher"
version = "0.3.11"
@@ -1703,7 +1857,7 @@ dependencies = [
"pest",
"pest_derive",
"phf",
- "semver",
+ "semver 0.11.0",
"sha2",
"signal-hook",
"siphasher",
@@ -1742,6 +1896,15 @@ dependencies = [
"syn 2.0.52",
]
+[[package]]
+name = "tiny-keccak"
+version = "2.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
+dependencies = [
+ "crunchy",
+]
+
[[package]]
name = "typenum"
version = "1.15.0"
diff --git a/Cargo.toml b/Cargo.toml
index ffd6410..b83b5a8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,21 +6,24 @@ keywords = ["watch", "command", "monitoring"]
license-file = "LICENSE"
name = "hwatch"
repository = "https://github.com/blacknon/hwatch"
-version = "0.3.13"
+version = "0.3.14"
[dependencies]
ansi-parser = "0.9.0"
-heapless = "0.6.1"
-
ansi_term = "0.12.1"
async-std = {version = "1.12"}
+chardetng = "0.1.17"
chrono = "0.4.34"
clap = {version = "4.5.3", features = ["cargo"]}
+config = {version = "0.14", default-features = false, features = ["ini"]}
crossbeam-channel = "0.5.12"
crossterm = "0.27.0"
ctrlc = {version = "3.4.2", features = ["termination"]}
-difference = "2.0"
+encoding_rs = "0.8"
+error-stack = "0.4.1"
+flate2 = "1.0.19"
futures = "0.3.30"
+heapless = "0.8.0"
question = "0.2.2"
ratatui = {version = "0.26.1", default-features = false, features = ['crossterm', 'unstable-rendered-line-info']}
regex = "1.10.3"
@@ -28,4 +31,5 @@ serde = "1.0.197"
serde_derive = "1.0.197"
serde_json = "1.0.114"
shell-words = "1.1.0"
+similar = {version = "2.5.0", features = ["serde", "unicode", "text", "inline", "bytes"]}
termwiz = "0.22.0"
diff --git a/README.md b/README.md
index 9273e2a..e275f27 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ hwatch
hwatch - alternative watch command.
-
+
## Description
@@ -17,6 +17,7 @@ That records the result of command execution and can display it history and diff
- Can keep the history when the difference, occurs and check it later.
- Can check the difference in the history. The display method can be changed in real time.
- Can output the execution result as log (json format).
+- Custom keymaps are available.
- Support ANSI color code.
- Execution result can be scroll.
- Not only as a TUI application, but also to have the differences output as standard output.
@@ -42,6 +43,8 @@ That records the result of command execution and can display it history and diff
## Usage
+### Command
+
$ hwatch --help
A modern alternative to the watch command, records the differences in execution results and can check this differences at after.
@@ -53,55 +56,132 @@ That records the result of command execution and can display it history and diff
Options:
-b, --batch output exection results to stdout
-B, --beep beep if command has a change result
+ --border Surround each pane with a border frame
+ --with-scrollbar When the border option is enabled, display scrollbar on the right side of watch pane.
--mouse enable mouse wheel support. With this option, copying text with your terminal may be harder. Try holding the Shift key.
-c, --color interpret ANSI color and style sequences
-r, --reverse display text upside down.
+ -C, --compress Compress data in memory.
-t, --no-title hide the UI on start. Use `t` to toggle it.
-N, --line-number show line number
--no-help-banner hide the "Display help with h key" message
-x, --exec Run the command directly, not through the shell. Much like the `-x` option of the watch command.
- -O, --diff-output-only Display only the lines with differences during line diff and word diff.
+ -O, --diff-output-only Display only the lines with differences during `line` diff and `word` diff.
-A, --aftercommand Executes the specified command if the output changes. Information about changes is stored in json format in environment variable ${HWATCH_DATA}.
- -l, --logfile logging file
+ -l, --logfile [] logging file
-s, --shell shell to use at runtime. can also insert the command to the location specified by {COMMAND}. [default: "sh -c"]
-n, --interval seconds to wait between updates [default: 2]
+ -L, --limit Set the number of history records to keep. only work in watch mode. Set `0` for unlimited recording. (default: 5000) [default: 5000]
--tab-size Specifying tab display size [default: 4]
-d, --differences [] highlight changes between updates [possible values: none, watch, line, word]
-o, --output [