https://github.com/datvm/runonsave
A simple tool to run shell command(s) whenever a file/folder changes.
https://github.com/datvm/runonsave
Last synced: 2 months ago
JSON representation
A simple tool to run shell command(s) whenever a file/folder changes.
- Host: GitHub
- URL: https://github.com/datvm/runonsave
- Owner: datvm
- License: mit
- Created: 2020-04-04T14:21:47.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-04T15:33:22.000Z (about 5 years ago)
- Last Synced: 2025-02-14T15:16:17.982Z (4 months ago)
- Language: C#
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RunOnSave
A simple .NET Core tool to run shell command(s) whenever a file/folder changes. I use this tool with IIS Express to have Live Reload for Cordova.
# Installation
You will need to have at least [.NET Core 3.1](https://dotnet.microsoft.com/download) installed.

Install the tool globally (-g or --global) from [Nuget](https://www.nuget.org/packages/LukeVo.RunOnSave):
```dotnet tool install -g LukeVo.RunOnSave```
You can check if it's successfully installed by running:
```runonsave```
# Usage
Simply run from your shell with this syntax:
```runonsave [ []]```

For example
```runonsave .\ "echo Hello World" "cordova build browser"```
will print out `Hello World` and then run the build command of `Cordova` whenever the current folder is changed.
There can only be one execution at the same time. If there is file change during the execution, they will be ignored.
## Note about double quote " on Windows
On Windows, the commands are executed by calling `cmd /c `, therefore you may have trouble with the double quote. For example, if I run from PowerShell:
```runonsave .\ "`"D:\Some Path\script.bat`""```
The script receive the argument as the string `"D:\Some Path\script.bat"` and then when entered into `cmd /c` it becomes:
```cmd /c "D:\Some Path\script.bat"```
Which, in turn cause problem because the command is actually `D:\Some Path\script.bat` (`D:\Some` filename with `Path\script.bat` argument).
To solve it, please use double quote instead:
```runonsave .\ "`"`"D:\Some Path\script.bat`"`""```