Skip to content

Commit 1dca196

Browse files
committed
removed wrapper functions and called in main instead
1 parent 35e8818 commit 1dca196

File tree

1 file changed

+19
-47
lines changed
  • skills/rca-annotator/scripts

1 file changed

+19
-47
lines changed

skills/rca-annotator/scripts/cli.py

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,47 +16,6 @@
1616
from jumpbox_io import download_from_jumpbox, upload_to_jumpbox
1717

1818

19-
def cmd_download(args: argparse.Namespace) -> int:
20-
"""
21-
Download analysis files from jumpbox.
22-
23-
Args:
24-
args: Parsed command-line arguments
25-
26-
Returns:
27-
0 on success, 1 on failure
28-
"""
29-
print(f"Downloading analysis files for job {args.job_id}...")
30-
31-
if download_from_jumpbox(args.job_id):
32-
print(f"\n Analysis files ready at .analysis/{args.job_id}/")
33-
return 0
34-
else:
35-
print("\n Failed to download analysis files")
36-
print(" Check JUMPBOX_URI environment variable and SSH configuration")
37-
return 1
38-
39-
40-
def cmd_upload(args: argparse.Namespace) -> int:
41-
"""
42-
Upload annotation_draft.json to jumpbox.
43-
44-
Args:
45-
args: Parsed command-line arguments
46-
47-
Returns:
48-
0 on success, 1 on failure
49-
"""
50-
print(f"Uploading annotation for job {args.job_id}...")
51-
52-
if upload_to_jumpbox(args.job_id):
53-
print("\n Annotation uploaded successfully")
54-
return 0
55-
else:
56-
print("\n Failed to upload annotation")
57-
return 1
58-
59-
6019
def main():
6120
"""Main entry point for CLI."""
6221
parser = argparse.ArgumentParser(
@@ -106,15 +65,28 @@ def main():
10665
parser.print_help()
10766
return 1
10867

109-
# Execute command
68+
job_id = args.job_id
69+
11070
if args.command == "download":
111-
return cmd_download(args)
112-
elif args.command == "upload":
113-
return cmd_upload(args)
114-
else:
115-
print(f"Unknown command: {args.command}")
71+
print(f"Downloading analysis files for job {job_id}...")
72+
if download_from_jumpbox(job_id):
73+
print(f"\n Analysis files ready at .analysis/{job_id}/")
74+
return 0
75+
print("\n Failed to download analysis files")
76+
print(" Check JUMPBOX_URI environment variable and SSH configuration")
11677
return 1
11778

79+
if args.command == "upload":
80+
print(f"Uploading annotation for job {job_id}...")
81+
if upload_to_jumpbox(job_id):
82+
print("\n Annotation uploaded successfully")
83+
return 0
84+
print("\n Failed to upload annotation")
85+
return 1
86+
87+
print(f"Unknown command: {args.command}")
88+
return 1
89+
11890

11991
if __name__ == "__main__":
12092
sys.exit(main())

0 commit comments

Comments
 (0)