@@ -68,13 +68,16 @@ def cmd_sprint(a):
6868 return 0
6969
7070 elif action in ("update" , "close" ):
71- if not a .id :
71+ target_id = a .id or getattr (a , "name" , None )
72+ if not target_id :
7273 print (f"onecoder sprint { action } : error: id is required" , file = sys .stderr )
7374 return 2
74- status = "completed" if action == "close" else a .status
75+ a .id = target_id
76+ status = "completed" if action == "close" else getattr (a , "status" , None )
77+ sp_name = a .name if (getattr (a , "name" , None ) and a .name != a .id ) else None
7578 sp = store .update_sprint (
7679 id = a .id ,
77- name = getattr ( a , "name" , None ) ,
80+ name = sp_name ,
7881 status = status ,
7982 starts_at = getattr (a , "starts_at" , None ),
8083 ends_at = getattr (a , "ends_at" , None )
@@ -132,14 +135,17 @@ def cmd_issue(a):
132135 return 0
133136
134137 elif action in ("update" , "close" ):
135- if not a .id :
138+ target_id = a .id or getattr (a , "title" , None )
139+ if not target_id :
136140 print (f"onecoder issue { action } : error: id is required" , file = sys .stderr )
137141 return 2
142+ a .id = target_id
138143 status = "closed" if action == "close" else getattr (a , "status" , None )
144+ iss_title = a .title if (getattr (a , "title" , None ) and a .title != a .id ) else None
139145 labels = [l .strip () for l in a .labels .split ("," )] if getattr (a , "labels" , None ) else None
140146 iss = store .update_issue (
141147 id = a .id ,
142- title = getattr ( a , "title" , None ) ,
148+ title = iss_title ,
143149 sprint = getattr (a , "sprint" , None ),
144150 status = status ,
145151 labels = labels
0 commit comments