cmd/accounts.go
changeset 28 79aa812c0dd2
parent 22 5778b09bc6fe
child 29 4f12e5d4ef75
equal deleted inserted replaced
27:f4af03fd34a5 28:79aa812c0dd2
   318 			break // No argument needed
   318 			break // No argument needed
   319 		}
   319 		}
   320 		if opt.accountID < 1 || len(opt.statusIDs) == 0 || opt.comment == "" {
   320 		if opt.accountID < 1 || len(opt.statusIDs) == 0 || opt.comment == "" {
   321 			return errors.New("missing parameter")
   321 			return errors.New("missing parameter")
   322 		}
   322 		}
       
   323 	case "followers", "following", "statuses":
       
   324 		// If the user's account ID is missing, get it
       
   325 		if opt.accountID < 1 {
       
   326 			// Sign in now to look the user id up
       
   327 			if err := madonInit(true); err != nil {
       
   328 				return err
       
   329 			}
       
   330 			account, err := gClient.GetCurrentAccount()
       
   331 			if err != nil {
       
   332 				return err
       
   333 			}
       
   334 			opt.accountID = account.ID
       
   335 		}
   323 	default:
   336 	default:
   324 		// The other subcommands here require an account ID
   337 		// The other subcommands here require an account ID
   325 		if opt.accountID < 1 {
   338 		if opt.accountID < 1 {
   326 			return errors.New("missing account ID")
   339 			return errors.New("missing account ID")
   327 		}
   340 		}