Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sethigeet/watcher
A simple command line app to watch files in a directory for changes and run a command when files change!
https://github.com/sethigeet/watcher
Last synced: about 2 months ago
JSON representation
A simple command line app to watch files in a directory for changes and run a command when files change!
- Host: GitHub
- URL: https://github.com/sethigeet/watcher
- Owner: sethigeet
- License: apache-2.0
- Created: 2022-01-01T04:58:29.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-03-25T11:19:12.000Z (about 2 years ago)
- Last Synced: 2024-01-07T21:07:42.354Z (5 months ago)
- Language: Go
- Size: 31.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- cli-apps - watcher - Watches all the files present in a directory and whenever a file is changed or a file is created/deleted from the directory, it runs a specified command. (<a name="file-watch"></a>File watching for changes)
- awesome-cli-apps - watcher - Watches all the files present in a directory and whenever a file is changed or a file is created/deleted from the directory, it runs a specified command. (<a name="file-watch"></a>File watching for changes)
README
# Watcher - Develop your programs easily
Watcher watches all the files present in the directory it is run from of the directory that is specified while running it and whenever a file is changed or a file is created/deleted from the directory, it runs the command specified while running it or a default command that it recognises from the contents of the current directory.
## Features
- [x] Choose which directory to watch for file changes
- [x] Specify amount of time to wait before running the command after a file change occurs
- [x] List the files that are being watched
- [x] Choose whether to run the command on startup
- [x] Set the maximum number of files that can be watched
- [x] Supports never ending processes such as dev servers as the command
- [x] Have a default ignore list
- [x] Press keys for force refreshing even when file change is not detected
- [x] Automatically recognize commands for popular project structure## Arguments
#### Command
The command you want to run when any file changes
```sh
watcher --cmd ''
or
watcher -x ''
```#### Directory
The directory that you want watcher to watch for file changes. _(default: ".")_
```sh
watcher --dir ''
```#### Ignore
The files that you want to ignore. It also supports file globbing.
```sh
watcher --ignore ''
```#### Ignore File
A file that contains the files that you want to ignore. It follows the gitignore file syntax
```sh
watcher --ignore-file ''
```#### Hidden
Whether the hidden files should also be watched for file changes. _(default: true)_
```sh
watcher --hidden false
```#### Clear
Whether to clear the terminal every time the command is rerun due to changed. _(default: true)_
```sh
watcher -c
or
watcher --clear
```#### Delay
The amount of time to wait before running the specified command after a file change occurs. _(default: 500ms)_
```sh
watcher --delay 1000ms
```#### Run on Start
Whether the specified command should run when watcher has first started. _(default: true)_
```sh
watcher --run-cmd-on-start false
or
watcher -r false
```#### List on Start
Whether the list of files being watched should be printed when watcher has first started. _(default: false)_
```sh
watcher --list-on-start true
```#### Limit
The maximum number of files that can be watched. _(default: 10000)_
```sh
watcher --limit 50000
or
watcher -l 50000
```> ⚠️ Every system has a maximum value which cannot be exceeded. To find it look at:
>
> - **Linux**: `/proc/sys/fs/inotify/max_user_watches` contains the limit, reaching this limit results in a "no space left on device" error.
> - **BSD / OSX**: `sysctl` variables `kern.maxfiles` and `kern.maxfilesperproc`, reaching these limits results in a "too many open files" error.## Examples
- **Basic** example (use _default_ options):
```sh
watcher
```
- **Intermediate** example:
```sh
watcher --delay 1s
```
- **Advanced** example:
```sh
watcher -x 'go run .' --dir '~/Projects/watcher' --hidden false -l 50000
```