diff options
-rwxr-xr-x | tools/deploy.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/tools/deploy.py b/tools/deploy.py index 62a4ed6..84e1c6a 100755 --- a/tools/deploy.py +++ b/tools/deploy.py @@ -23,20 +23,27 @@ def main() -> None: default="/srv/http/deploy.xengineering.eu/public/git/iot-contact/main/", help="remote path to destination folder on server", ) + parser.add_argument( + "-d", + "--dry-run", + action="store_true", + help="do not execute command and instead print it", + ) args = parser.parse_args() - subprocess.run( - [ - "rsync", - "-av", - "--delete", - f"{str(pathlib.Path(args.artifacts))}/", - f"{args.host}:{args.path}", - ], - shell=False, - check=True, - ) + command = [ + "rsync", + "-av", + "--delete", + f"{str(pathlib.Path(args.artifacts).resolve())}/", + f"{args.host}:{args.path}", + ] + + if args.dry_run: + print(command) + else: + subprocess.run(command, shell=False, check=True) if __name__ == "__main__": |