feat: --gitpush
This commit is contained in:
parent
a88e284a04
commit
7e9a57ebb1
3 changed files with 7 additions and 3 deletions
|
|
@ -25,6 +25,7 @@ Currently, WatchYap can perform the following actions:
|
||||||
- `--save`,
|
- `--save`,
|
||||||
- `--inkscape`,
|
- `--inkscape`,
|
||||||
- `--git`,
|
- `--git`,
|
||||||
|
- `--gitpush`,
|
||||||
- `--log`,
|
- `--log`,
|
||||||
- `--dbus` (disabled if the `sdbus` python module is not installed),
|
- `--dbus` (disabled if the `sdbus` python module is not installed),
|
||||||
- `--zenity` (disabled if the `zenity` command is not installed, or if no graphical display is available),
|
- `--zenity` (disabled if the `zenity` command is not installed, or if no graphical display is available),
|
||||||
|
|
@ -40,7 +41,7 @@ For instance, with a target file named `test.svg`, a snapshot will look like `te
|
||||||
|
|
||||||
### Synopsis
|
### Synopsis
|
||||||
|
|
||||||
`watchyap.py [-h] [--save] [--inkscape] [--git] [--log] [--dbus] [-d DIRECTORY] [-y DELAY] [-s SEPARATOR] [-t TEMPLATE] [-w] [-v {DEBUG,INFO,WARNING,ERROR}] [-e {opened,moved,deleted,created,modified,closed}...] target [target ...]`
|
`watchyap.py [-h] [--save] [--inkscape] [--git] [--gitpush] [--log] [--dbus] [-d DIRECTORY] [-y DELAY] [-s SEPARATOR] [-t TEMPLATE] [-w] [-v {DEBUG,INFO,WARNING,ERROR}] [-e {opened,moved,deleted,created,modified,closed}...] target [target ...]`
|
||||||
|
|
||||||
### Required positional argument
|
### Required positional argument
|
||||||
|
|
||||||
|
|
@ -53,6 +54,7 @@ Actions:
|
||||||
* `--save`: Save a snapshot of the watched file.
|
* `--save`: Save a snapshot of the watched file.
|
||||||
* `--inkscape`: Save a PNG snpashot of the watched SVG file.
|
* `--inkscape`: Save a PNG snpashot of the watched SVG file.
|
||||||
* `--git`: Commit the watched file if it has been modified.
|
* `--git`: Commit the watched file if it has been modified.
|
||||||
|
* `--gitpush`: Commit, pull and push the watched file if it has been modified.
|
||||||
* `--log`: Print a message.
|
* `--log`: Print a message.
|
||||||
* `--dbus`: Send a notification to the system's D-Bus.
|
* `--dbus`: Send a notification to the system's D-Bus.
|
||||||
* `--zenity`: Pop-up a dialog window.
|
* `--zenity`: Pop-up a dialog window.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "watchyap"
|
name = "watchyap"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
description = "Automagically perform an action each time you touch watched files"
|
description = "Automagically perform an action each time you touch watched files"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [
|
authors = [
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ Examples:
|
||||||
if shutil.which("git"):
|
if shutil.which("git"):
|
||||||
HAS_GIT = True
|
HAS_GIT = True
|
||||||
existing["git"] = ["Commit the target files if it has been modified [the repository should be set-up].", None]
|
existing["git"] = ["Commit the target files if it has been modified [the repository should be set-up].", None]
|
||||||
|
existing["gitpush"] = ["Commit, pull and push the target files if it has been modified [the repository should be set-up].", None]
|
||||||
else:
|
else:
|
||||||
HAS_GIT = False
|
HAS_GIT = False
|
||||||
|
|
||||||
|
|
@ -136,8 +137,9 @@ Examples:
|
||||||
if HAS_GIT:
|
if HAS_GIT:
|
||||||
logging.debug("`git` command found")
|
logging.debug("`git` command found")
|
||||||
available["git"][1] = Command("git add {target} ; git commit -m 'Automatic watchyap commit of {target} at {timestamp}'")
|
available["git"][1] = Command("git add {target} ; git commit -m 'Automatic watchyap commit of {target} at {timestamp}'")
|
||||||
|
available["gitpush"][1] = Command("git add {target} ; git commit -m 'Automatic watchyap commit of {target} at {timestamp}' ; git pull ; git push")
|
||||||
else:
|
else:
|
||||||
print("WARNING: `git` command not found, the --inkscape action is disabled.", file=sys.stderr)
|
print("WARNING: `git` command not found, the --git* actions are disabled.", file=sys.stderr)
|
||||||
|
|
||||||
if HAS_INKSCAPE:
|
if HAS_INKSCAPE:
|
||||||
logging.debug("`inkscape` command found")
|
logging.debug("`inkscape` command found")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue