@@ -467,13 +467,15 @@ account is already at that limit.`,
467467 Example : " $ basecamp projects unarchive 12345" ,
468468 Args : cobra .MaximumNArgs (1 ),
469469 RunE : func (cmd * cobra.Command , args []string ) error {
470- return runProjectStatusChange (cmd , args , (* basecamp .ProjectsService ).Unarchive , "active" , "Project restored" , "archive " , "Archive the project " )
470+ return runProjectStatusChange (cmd , args , (* basecamp .ProjectsService ).Unarchive , "active" , "Project restored" , "" , "" )
471471 },
472472 }
473473}
474474
475475// runProjectStatusChange makes the change, which answers with no body, and
476- // reports the status it set, with the command that undoes it as a follow-up.
476+ // reports the status it set. inverse names the command that undoes it, offered
477+ // as a follow-up; unarchive has none, since a project it restored may have
478+ // come from the trash rather than the archive.
477479func runProjectStatusChange (cmd * cobra.Command , args []string , change func (* basecamp.ProjectsService , context.Context , int64 ) error , status , summary , inverse , inverseDescription string ) error {
478480 if len (args ) == 0 {
479481 return missingArg (cmd , "<id>" )
@@ -499,23 +501,24 @@ func runProjectStatusChange(cmd *cobra.Command, args []string, change func(*base
499501 }
500502
501503 scopeArgs := scope .args (app .Config .AccountID )
504+ crumbs := []output.Breadcrumb {{
505+ Action : "show" ,
506+ Cmd : fmt .Sprintf ("basecamp projects show %d" , projectID ) + scopeArgs ,
507+ Description : "View the project" ,
508+ }}
509+ if inverse != "" {
510+ crumbs = append (crumbs , output.Breadcrumb {
511+ Action : inverse ,
512+ Cmd : fmt .Sprintf ("basecamp projects %s %d" , inverse , projectID ) + scopeArgs ,
513+ Description : inverseDescription ,
514+ })
515+ }
502516 return app .OK (map [string ]any {
503517 "id" : projectID ,
504518 "status" : status ,
505519 },
506520 output .WithSummary (summary ),
507- output .WithBreadcrumbs (
508- output.Breadcrumb {
509- Action : "show" ,
510- Cmd : fmt .Sprintf ("basecamp projects show %d" , projectID ) + scopeArgs ,
511- Description : "View the project" ,
512- },
513- output.Breadcrumb {
514- Action : inverse ,
515- Cmd : fmt .Sprintf ("basecamp projects %s %d" , inverse , projectID ) + scopeArgs ,
516- Description : inverseDescription ,
517- },
518- ),
521+ output .WithBreadcrumbs (crumbs ... ),
519522 )
520523}
521524
0 commit comments