Skip to content

Commit d562bd6

Browse files
committed
fix: consolidate recent installer and wizard reliability fixes
1 parent 679f860 commit d562bd6

5 files changed

Lines changed: 371 additions & 179 deletions

File tree

git_auto_sync/cli.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import subprocess
77
import sys
88

9+
from git_auto_sync import __version__
910
from git_auto_sync.config import ConfigError, load_config
1011
from git_auto_sync.engine import run_sync, should_notify
1112
from git_auto_sync.notifiers import build_notifiers, format_summary
@@ -136,6 +137,11 @@ def _cmd_update(args) -> int:
136137

137138
def build_parser() -> argparse.ArgumentParser:
138139
parser = argparse.ArgumentParser(prog="git-auto-sync")
140+
parser.add_argument(
141+
"--version",
142+
action="version",
143+
version=f"git-auto-sync {__version__}",
144+
)
139145
sub = parser.add_subparsers(dest="command", required=True)
140146

141147
p_init = sub.add_parser("init", help="interactive setup wizard")
@@ -183,7 +189,11 @@ def build_parser() -> argparse.ArgumentParser:
183189
def main(argv: list[str] | None = None) -> int:
184190
parser = build_parser()
185191
args = parser.parse_args(argv)
186-
return args.func(args)
192+
try:
193+
return args.func(args)
194+
except (KeyboardInterrupt, EOFError):
195+
print("\n⚠ Interrupted by user.", file=sys.stderr)
196+
return 130
187197

188198

189199
if __name__ == "__main__":

0 commit comments

Comments
 (0)