2015-08-21 13:02:36 +00:00
|
|
|
//
|
|
|
|
// Account.swift
|
|
|
|
// mas-cli
|
|
|
|
//
|
|
|
|
// Created by Andrew Naylor on 21/08/2015.
|
|
|
|
// Copyright (c) 2015 Andrew Naylor. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
struct AccountCommand: CommandType {
|
|
|
|
let verb = "account"
|
|
|
|
let function = "Prints the primary account Apple ID"
|
|
|
|
|
|
|
|
func run(mode: CommandMode) -> Result<(), CommandantError<MASError>> {
|
|
|
|
switch mode {
|
|
|
|
case .Arguments:
|
2015-08-24 18:44:47 +00:00
|
|
|
if let account = ISStoreAccount.primaryAccount {
|
2015-09-14 08:51:09 +00:00
|
|
|
print(account.identifier)
|
2015-08-24 18:44:47 +00:00
|
|
|
}
|
|
|
|
else {
|
2015-09-14 08:51:09 +00:00
|
|
|
print("Not signed in")
|
2015-08-24 18:44:47 +00:00
|
|
|
exit(MASErrorCode.NotSignedIn.exitCode)
|
|
|
|
}
|
2015-08-21 13:02:36 +00:00
|
|
|
default:
|
|
|
|
break
|
|
|
|
}
|
2015-09-14 08:51:09 +00:00
|
|
|
return .Success(())
|
2015-08-21 13:02:36 +00:00
|
|
|
}
|
2015-08-21 18:22:06 +00:00
|
|
|
}
|