Skip to content

Commit

Permalink
Merge pull request #126 from daniejstriata/master
Browse files Browse the repository at this point in the history
add bash completion and RPM Spec file
  • Loading branch information
blacknon authored Jun 18, 2024
2 parents df88367 + 637e4ec commit e8d0db8
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
14 changes: 14 additions & 0 deletions completion/bash/hwatch-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
_hwatch() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-b --batch -B --beep --border --with-scrollbar --mouse -c --color -r --reverse -C --compress -t --no-title -N --line-number --no-help-banner -x --exec -O --diff-output-only -A --aftercommand -l --logfile -s --shell -n --interval -L --limit --tab-size -d --differences -o --output -K --keymap -h --help -V --version"

if [[ ${cur} == -* ]]; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}

complete -F _hwatch hwatch
59 changes: 59 additions & 0 deletions hwatch.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Name: hwatch
Version: 0.3.14
Release: 2%{?dist}
Summary: A modern alternative to the 'watch' command, it records differences in execution results and allows for examination of these differences afterward.
URL: https://github.com/blacknon/hwatch/
License: MIT
Source0: https://github.com/blacknon/hwatch/archive/refs/tags/%{version}.tar.gz

BuildRequires: git
BuildRequires: python3
BuildRequires: curl
BuildRequires: gcc

%define debug_package %{nil}

%description
hwatch is a alternative watch command. Records the results of command execution that can display its history and differences.

Features:
* 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.
* If a difference occurs, you can have the specified command additionally executed.

%prep
%setup -q

%build
# Install Rust using curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH="$PATH:$HOME/.cargo/bin"
$HOME/.cargo/bin/cargo build --release --all-features
strip target/release/%{name}

%install
install -D -m 644 completion/bash/%{name}-completion.bash %{buildroot}/etc/bash_completion.d/%{name}.bash
install -D -m 755 target/release/%{name} %{buildroot}/usr/bin/%{name}
install -D -m 644 LICENSE %{buildroot}/usr/share/licenses/%{name}/LICENSE
install -D -m 644 README.md %{buildroot}/usr/share/doc/%{name}/README.md

%check
$HOME/.cargo/bin/cargo test --release --locked --all-features

%files
%license LICENSE
%doc README.md
/usr/bin/%{name}
/etc/bash_completion.d/%{name}.bash

%changelog
* Mon May 13 2024 Danie de Jager - 0.3.14-2
- strip binary
- add bash completion
* Mon May 13 2024 Danie de Jager - 0.3.14-1
- Initial version

0 comments on commit e8d0db8

Please sign in to comment.