@@ -60,7 +60,11 @@ def show(context: Context, args: list):
6060 print ("ERROR: No history ID provided." )
6161 return
6262 gi = connect (context )
63- history = gi .histories .show_history (args [0 ], contents = contents )
63+ hid = find_history (gi , args [0 ])
64+ if hid is None :
65+ print (f"ERROR: No such history { args [0 ]} " )
66+ return
67+ history = gi .histories .show_history (hid , contents = contents )
6468 print (json .dumps (history , indent = 4 ))
6569
6670
@@ -127,8 +131,8 @@ def export(context: Context, args: list):
127131 if len (args ) == 0 :
128132 print ("ERROR: no history ID specified" )
129133 return
130- hid = args [0 ]
131134 gi = connect (context )
135+ hid = find_history (gi , args [0 ])
132136 jeha_id = gi .histories .export_history (hid , gzip = True , wait = wait )
133137 # global GALAXY_SERVER
134138 export_url = "unknown"
@@ -154,7 +158,7 @@ def publish(context: Context, args: list):
154158 print ("ERROR: No history ID provided." )
155159 return
156160 gi = connect (context )
157- result = gi .histories .update_history (args [0 ], published = True )
161+ result = gi .histories .update_history (find_history ( gi , args [0 ]) , published = True )
158162 print (f"Published: { result ['published' ]} " )
159163
160164
@@ -164,7 +168,7 @@ def rename(context: Context, args: list):
164168 print ("USAGE: rename ID 'new history name'" )
165169 return
166170 gi = connect (context )
167- result = gi .histories .update_history (args [0 ], name = args [1 ])
171+ result = gi .histories .update_history (find_history ( gi , args [0 ]) , name = args [1 ])
168172 print (f"History renamed to { result ['name' ]} " )
169173
170174
@@ -272,7 +276,7 @@ def copy(context:Context, args:list):
272276 if len (args ) != 2 :
273277 print ("ERROR: Invalid parameters. Provide a history ID and new history name." )
274278 return
275- id = args [0 ]
279+ id = find_history ( args [0 ])
276280 name = args [1 ]
277281
278282 gi = connect (context )
@@ -318,7 +322,7 @@ def tag(context: Context, args: list):
318322 return
319323
320324 gi = connect (context )
321- hid = args .pop (0 )
325+ hid = find_history ( gi , args .pop (0 ) )
322326 if not replace :
323327 history = gi .histories .show_history (hid , contents = False )
324328 args += history ['tags' ]
@@ -332,7 +336,7 @@ def summarize(context: Context, args: list):
332336 gi = connect (context )
333337 all_jobs = []
334338 while len (args ) > 0 :
335- hid = args .pop (0 )
339+ hid = find_history ( gi , args .pop (0 ) )
336340 history = gi .histories .show_history (history_id = hid )
337341 jobs = gi .jobs .get_jobs (history_id = hid )
338342 for job in jobs :
0 commit comments