CLI-CAL-001/002/003/004/005/006/007/008/009/010: Add calendar command group and CRUD plan commands
- Add hf calendar command group to command surface and router - Implement schedule/show/edit/cancel/date-list commands - Implement plan-schedule/plan-list/plan-edit/plan-cancel commands - Add leaf help for all calendar commands - Align CLI with backend calendar routes and response envelopes - Support virtual slot ids for edit/cancel - Validate with go build and go test ./...
This commit is contained in:
@@ -190,6 +190,9 @@ func handleGroup(group help.Group, args []string) {
|
||||
case "proposal", "propose":
|
||||
handleProposalCommand(sub.Name, remaining)
|
||||
return
|
||||
case "calendar":
|
||||
handleCalendarCommand(sub.Name, remaining)
|
||||
return
|
||||
case "comment":
|
||||
handleCommentCommand(sub.Name, remaining)
|
||||
return
|
||||
@@ -700,6 +703,45 @@ func handleSupportCommand(subCmd string, args []string) {
|
||||
}
|
||||
}
|
||||
|
||||
func handleCalendarCommand(subCmd string, args []string) {
|
||||
tokenFlag := ""
|
||||
var filtered []string
|
||||
for i := 0; i < len(args); i++ {
|
||||
switch args[i] {
|
||||
case "--token":
|
||||
if i+1 < len(args) {
|
||||
i++
|
||||
tokenFlag = args[i]
|
||||
}
|
||||
default:
|
||||
filtered = append(filtered, args[i])
|
||||
}
|
||||
}
|
||||
|
||||
switch subCmd {
|
||||
case "schedule":
|
||||
commands.RunCalendarSchedule(filtered, tokenFlag)
|
||||
case "show":
|
||||
commands.RunCalendarShow(filtered, tokenFlag)
|
||||
case "edit":
|
||||
commands.RunCalendarEdit(filtered, tokenFlag)
|
||||
case "cancel":
|
||||
commands.RunCalendarCancel(filtered, tokenFlag)
|
||||
case "date-list":
|
||||
commands.RunCalendarDateList(filtered, tokenFlag)
|
||||
case "plan-schedule":
|
||||
commands.RunCalendarPlanSchedule(filtered, tokenFlag)
|
||||
case "plan-list":
|
||||
commands.RunCalendarPlanList(filtered, tokenFlag)
|
||||
case "plan-edit":
|
||||
commands.RunCalendarPlanEdit(filtered, tokenFlag)
|
||||
case "plan-cancel":
|
||||
commands.RunCalendarPlanCancel(filtered, tokenFlag)
|
||||
default:
|
||||
output.Errorf("hf calendar %s is not implemented yet", subCmd)
|
||||
}
|
||||
}
|
||||
|
||||
func handleProposalCommand(subCmd string, args []string) {
|
||||
tokenFlag := ""
|
||||
var filtered []string
|
||||
|
||||
Reference in New Issue
Block a user