{"id":13586957,"url":"https://github.com/blacknon/hwatch","last_synced_at":"2025-10-21T04:52:10.763Z","repository":{"id":39166373,"uuid":"120421295","full_name":"blacknon/hwatch","owner":"blacknon","description":"A modern alternative to the watch command, records the differences in execution results and can check this differences at after.","archived":false,"fork":false,"pushed_at":"2025-09-22T00:54:45.000Z","size":33869,"stargazers_count":939,"open_issues_count":22,"forks_count":26,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-09-22T01:21:04.998Z","etag":null,"topics":["command-line","monitoring","rust","terminal-ui","tui","watch"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blacknon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-02-06T08:01:20.000Z","updated_at":"2025-09-19T10:13:28.000Z","dependencies_parsed_at":"2023-02-06T06:17:08.757Z","dependency_job_id":"2e9ba4b4-9dc9-42cd-a4d1-342da5421c84","html_url":"https://github.com/blacknon/hwatch","commit_stats":{"total_commits":369,"total_committers":13,"mean_commits":"28.384615384615383","dds":0.2845528455284553,"last_synced_commit":"1267168468948ce4d14e61f837ac3c3474a52563"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/blacknon/hwatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacknon%2Fhwatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacknon%2Fhwatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacknon%2Fhwatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacknon%2Fhwatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blacknon","download_url":"https://codeload.github.com/blacknon/hwatch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blacknon%2Fhwatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280207189,"owners_count":26290616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line","monitoring","rust","terminal-ui","tui","watch"],"created_at":"2024-08-01T15:05:56.038Z","updated_at":"2025-10-21T04:52:10.747Z","avatar_url":"https://github.com/blacknon.png","language":"Rust","funding_links":[],"categories":["Rust","💻 Apps"],"sub_categories":["🌌 Other"],"readme":"hwatch\n======\n\nhwatch - alternative watch command.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./img/hwatch.gif\" /\u003e\n\u003c/p\u003e\n\n## Description\n\n`hwatch` is a alternative **watch** command.\nThat records the result of command execution and can display it history and diffs.\n\n### Features\n\n- Can keep the history when the difference, occurs and check it later.\n- Can check the difference in the history. The display method can be changed in real time.\n- Can output the execution result as log (json format).\n- Custom keymaps are available.\n- Support ANSI color code.\n- Execution result can be scroll.\n- Not only as a TUI application, but also to have the differences output as standard output.\n- If a difference occurs, you can have the specified command additionally executed.\n\n## Install\n\n### macOS (brew)\n\n    brew install hwatch\n\n### macOS (MacPorts)\n\n    sudo port install hwatch\n\n### Arch Linux (AUR)\n\n    paru -S hwatch\n\n### Cargo Install\n\n    cargo install hwatch\n\n## Usage\n\n### Command\n\n        $ hwatch --help\n        A modern alternative to the watch command, records the differences in execution results and can check this differences at after.\n\n        Usage: hwatch [OPTIONS] [command]...\n\n        Arguments:\n          [command]...\n\n        Options:\n          -b, --batch                         output execution results to stdout\n          -B, --beep                          beep if command has a change result\n              --border                        Surround each pane with a border frame\n              --with-scrollbar                When the border option is enabled, display scrollbar on the right side of watch pane.\n              --mouse                         enable mouse wheel support. With this option, copying text with your terminal may be harder. Try holding the Shift key.\n          -c, --color                         interpret ANSI color and style sequences\n          -r, --reverse                       display text upside down.\n          -C, --compress                      Compress data in memory. Note: If the output of the command is small, you may not get the desired effect.\n          -t, --no-title                      hide the UI on start. Use `t` to toggle it.\n          -N, --line-number                   show line number\n              --no-help-banner                hide the \"Display help with h key\" message\n          -x, --exec                          Run the command directly, not through the shell. Much like the `-x` option of the watch command.\n          -O, --diff-output-only              Display only the lines with differences during `line` diff and `word` diff.\n          -A, --aftercommand \u003cafter_command\u003e  Executes the specified command if the output changes. Information about changes is stored in json format in environment variable ${HWATCH_DATA}.\n          -l, --logfile [\u003clogfile\u003e]           logging file. if a log file is already used, its contents will be read and executed.\n          -s, --shell \u003cshell_command\u003e         shell to use at runtime. can also insert the command to the location specified by {COMMAND}. [default: \"sh -c\"]\n          -n, --interval \u003cinterval\u003e           seconds to wait between updates [default: 2]\n              --precise                       Attempt to run as close to the interval as possible, regardless of how long the command takes to run\n          -L, --limit \u003climit\u003e                 Set the number of history records to keep. only work in watch mode. Set `0` for unlimited recording. (default: 5000) [default: 5000]\n              --tab-size \u003ctab_size\u003e           Specifying tab display size [default: 4]\n          -d, --differences [\u003cdifferences\u003e]   highlight changes between updates [possible values: none, watch, line, word]\n          -o, --output [\u003coutput\u003e]             Select command output. [default: output] [possible values: output, stdout, stderr]\n          -K, --keymap \u003ckeymap\u003e               Add keymap\n          -h, --help                          Print help\n          -V, --version                       Print version\n\n### Keybind\n\nWatch mode keybind(Default).\n\n| Key                                                                                        | Action                                                      |\n| ------------------------------------------------------------------------------------------ | ----------------------------------------------------------- |\n| \u003ckbd\u003e↑\u003c/kbd\u003e, \u003ckbd\u003e↓\u003c/kbd\u003e                                                                 | move selected screen(history/watch).                        |\n| \u003ckbd\u003epageup\u003c/kbd\u003e, \u003ckbd\u003epagedn\u003c/kbd\u003e                                                       | move selected screen(history/watch).                        |\n| \u003ckbd\u003ehome\u003c/kbd\u003e, \u003ckbd\u003eend\u003c/kbd\u003e                                                            | move selected screen(history/watch).                        |\n| \u003ckbd\u003eTab\u003c/kbd\u003e                                                                             | toggle select screen(history/watch).                        |\n| \u003ckbd\u003e←\u003c/kbd\u003e                                                                               | select watch screen.                                        |\n| \u003ckbd\u003e→\u003c/kbd\u003e                                                                               | select history screen.                                      |\n| \u003ckbd\u003eAlt\u003c/kbd\u003e+\u003ckbd\u003e←\u003c/kbd\u003e, \u003ckbd\u003eAlt\u003c/kbd\u003e+\u003ckbd\u003e→\u003c/kbd\u003e                                   | Watch window scrll left/right.                              |\n| \u003ckbd\u003eShift\u003c/kbd\u003e+\u003ckbd\u003eAlt\u003c/kbd\u003e+\u003ckbd\u003e←\u003c/kbd\u003e, \u003ckbd\u003eShift\u003c/kbd\u003e+\u003ckbd\u003eAlt\u003c/kbd\u003e+\u003ckbd\u003e→\u003c/kbd\u003e | Watch window scrll start/end.                               |\n| \u003ckbd\u003eQ\u003c/kbd\u003e                                                                               | exit hwatch.                                                |\n| \u003ckbd\u003eEsc\u003c/kbd\u003e                                                                             | unfiltering.                                                |\n| \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ec\u003c/kbd\u003e                                                               | cancel.                                                     |\n| \u003ckbd\u003eH\u003c/kbd\u003e                                                                               | show help window.                                           |\n| \u003ckbd\u003eB\u003c/kbd\u003e                                                                               | toggle enable/disable border.                               |\n| \u003ckbd\u003eC\u003c/kbd\u003e                                                                               | toggle color.                                               |\n| \u003ckbd\u003eN\u003c/kbd\u003e                                                                               | switch line number display.                                 |\n| \u003ckbd\u003eR\u003c/kbd\u003e                                                                               | toggle reverse mode.                                        |\n| \u003ckbd\u003eM\u003c/kbd\u003e                                                                               | toggle mouse support.                                       |\n| \u003ckbd\u003eT\u003c/kbd\u003e                                                                               | toggle the UI (history pane and header).                    |\n| \u003ckbd\u003eBackspace\u003c/kbd\u003e                                                                       | toggle the history pane.                                    |\n| \u003ckbd\u003eD\u003c/kbd\u003e                                                                               | switch diff mode.                                           |\n| \u003ckbd\u003e0\u003c/kbd\u003e                                                                               | disable diff.                                               |\n| \u003ckbd\u003e1\u003c/kbd\u003e                                                                               | switch watch type diff.                                     |\n| \u003ckbd\u003e2\u003c/kbd\u003e                                                                               | switch line type diff.                                      |\n| \u003ckbd\u003e3\u003c/kbd\u003e                                                                               | switch word type diff.                                      |\n| \u003ckbd\u003eShift\u003c/kbd\u003e+\u003ckbd\u003eO\u003c/kbd\u003e                                                              | show only lines with differences(line/word diff mode only). |\n| \u003ckbd\u003eO\u003c/kbd\u003e                                                                               | switch output mode(output-\u003estdout-\u003estderr).                 |\n| \u003ckbd\u003eW\u003c/kbd\u003e                                                                               | Toggle wrap.                                                |\n| \u003ckbd\u003eF1\u003c/kbd\u003e                                                                              | only stdout print.                                          |\n| \u003ckbd\u003eF2\u003c/kbd\u003e                                                                              | only stderr print.                                          |\n| \u003ckbd\u003eF3\u003c/kbd\u003e                                                                              | print output.                                               |\n| \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003eN\u003c/kbd\u003e                                                               | Forcus next keyword.                                        |\n| \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003eP\u003c/kbd\u003e                                                               | Forcus before keyword.                                      |\n| \u003ckbd\u003eShift\u003c/kbd\u003e+\u003ckbd\u003eS\u003c/kbd\u003e                                                              | show summary infomation in history.                         |\n| \u003ckbd\u003e+\u003c/kbd\u003e                                                                               | increase interval.                                          |\n| \u003ckbd\u003e-\u003c/kbd\u003e                                                                               | decrease interval.                                          |\n| \u003ckbd\u003eP\u003c/kbd\u003e                                                                               | Pause/unpause execution.                                    |\n| \u003ckbd\u003e/\u003c/kbd\u003e                                                                               | filter history by string.                                   |\n| \u003ckbd\u003e*\u003c/kbd\u003e                                                                               | filter history by regex.                                    |\n\n#### Custom keybind\n\nCan customize key bindings by using the `-K` Option.\nWrite it in the format `keybind=funciton`.\n\n```bash\nhwatch -K ctrl-p=history_pane_up -K ctrl-n=history_pane_down command...\n```\n\nKeybind functions that can be specified are as follows.\n\n| function                 | description                                |\n| ------------------------ | ------------------------------------------ |\n| up                       | Move up                                    |\n| watch_pane_up            | Move up in watch pane                      |\n| history_pane_up          | Move up in history pane                    |\n| down                     | Move down                                  |\n| watch_pane_down          | Move down in watch pane                    |\n| history_pane_down        | Move down in history pane                  |\n| scroll_right             | Move page right in watch pane              |\n| scroll_horizontal_end    | Move page right end in watch pane          |\n| scroll_left              | Move page left in watch pane               |\n| scroll_horizontal_home   | Move page left start in watch pane         |\n| page_up                  | Move page up                               |\n| watch_pane_page_up       | Move page up in watch pane                 |\n| history_pane_page_up     | Move page up in history pane               |\n| page_down                | Move page down                             |\n| watch_pane_page_down     | Move page down in watch pane               |\n| history_pane_page_down   | Move page down in history pane             |\n| move_top                 | Move top                                   |\n| watch_pane_move_top      | Move top in watch pane                     |\n| history_pane_move_top    | Move top in history pane                   |\n| move_end                 | Move end                                   |\n| watch_pane_move_end      | Move end in watch pane                     |\n| history_pane_move_end    | Move end in history pane                   |\n| toggle_forcus            | Toggle forcus window                       |\n| forcus_watch_pane        | Forcus watch pane                          |\n| forcus_history_pane      | Forcus history pane                        |\n| quit                     | Quit hwatch                                |\n| reset                    | filter reset                               |\n| cancel                   | Cancel                                     |\n| force_cancel             | Cancel without displaying the exit dialog  |\n| help                     | Show and hide help window                  |\n| toggle_color             | Toggle enable/disable ANSI Color           |\n| toggle_line_number       | Toggle enable/disable Line Number          |\n| toggle_reverse           | Toggle enable/disable text reverse         |\n| toggle_mouse_support     | Toggle enable/disable mouse support        |\n| toggle_view_pane_ui      | Toggle view header/history pane            |\n| toggle_view_header_pane  | Toggle view header pane                    |\n| toggle_view_history_pane | Toggle view history pane                   |\n| toggle_border            | Toggle enable/disable border               |\n| toggle_scroll_bar        | Toggle enable/disable scroll bar           |\n| toggle_diff_mode         | Toggle diff mode                           |\n| set_diff_mode_plane      | Set diff mode plane                        |\n| set_diff_mode_watch      | Set diff mode watch                        |\n| set_diff_mode_line       | Set diff mode line                         |\n| set_diff_mode_word       | Set diff mode word                         |\n| set_diff_only            | Set diff line only (line/word diff only)   |\n| toggle_output_mode       | Toggle output mode                         |\n| set_output_mode_output   | Set output mode output                     |\n| set_output_mode_stdout   | Set output mode stdout                     |\n| set_output_mode_stderr   | Set output mode stderr                     |\n| toggle_wrap_mode         | Toggle watch pane text wrap enable/disable |\n| toggle_history_summary   | Toggle history summary                     |\n| interval_plus            | Interval +0.5sec                           |\n| interval_minus           | Interval -0.5sec                           |\n| toggle_pause             | Toggle pause execution                     |\n| prev_keyword             | Forcus previous keyword                    |\n| next_keyword             | Forcus next keyword                        |\n| change_filter_mode       | Change filter mode                         |\n| change_regex_filter_mode | Change regex filter mode                   |\n\n\n## Configuration\n\nIf you always want to use some command-line options, you can set them in the\n`HWATCH` environment variable. For example, if you use `bash`, you can add\nthe following to your `.bashrc`:\n\n```bash\nexport HWATCH=\"--no-title --color --no-help-banner --border --with-scrollbar\"\n```\n\n## Example\n\n### interval 3 second\n\nUse the -n option to specify the command execution interval.\n\n```bash\nhwatch -n 3 command...\n```\n\n### logging output\n\nThe command execution result can be output as a log in json format.\n\n```bash\nhwatch -n 3 -l hwatch_log.json command...\n```\n\nWhen you check the json log, you can easily check it by using [this script](https://gist.github.com/blacknon/551e52dce1651d2510162def5a0da1f0).\n\n### Use shell function\n\nIf you want the shell function to be executed periodically, you can specify the shell command to be executed with -s as follows.\n\n```bash\n# bash\nhwatch -n 3 -s 'bash -c \"source ~/.bashrc\"; {COMMAND}' command...\n\n# zsh\nhwatch -n 3 -s 'zsh -c \"source ~/.zshrc\"; {COMMAND}' command...\n```\n\n### ANSI Color code\n\nIf you want to see output colored with ANSI color code, enable color mode.\n\nTo enable color mode, run hwatch with the `-c` option.\nAlternatively, you can enable / disable the color mode with the \u003ckbd\u003eC\u003c/kbd\u003e key during execution.\n\n```bash\nhwatch -n 3 -c command...\n```\n\n### diff view\n\nTo enable color mode, run hwatch with the `-d` option.\n\nThere are several \"diff modes\" available.\nSwitching can be done with the \u003ckbd\u003eD\u003c/kbd\u003e key.\n\n```bash\nhwatch -n 3 -d command...\n```\n\n#### watch diff\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./img/watch_diff.jpg\" /\u003e\n\u003c/p\u003e\n\n#### line diff\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./img/line_diff.jpg\" /\u003e\n\u003c/p\u003e\n\n#### word diff\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./img/word_diff.jpg\" /\u003e\n\u003c/p\u003e\n\n### history filtering\n\nYou can filter history as a string with \u003ckbd\u003e/\u003c/kbd\u003e key and as a regular expression with \u003ckbd\u003e*\u003c/kbd\u003e key.\n\n### run batch mode\n\nYou can have command diffs output directly to stdout instead with `-b` option of getting them as a TUI app.\n\n```bash\nhwatch -b command...\n```\n\n## Alternatives\n- The original [`watch`](https://man7.org/linux/man-pages/man1/watch.1.html);\n  the newest version seems to be distributed as a part of\n  [`procps`](https://gitlab.com/procps-ng/procps).\n- [Viddy](https://github.com/sachaos/viddy).\n- [sasqwatch](https://github.com/fabio42/sasqwatch)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacknon%2Fhwatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblacknon%2Fhwatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblacknon%2Fhwatch/lists"}