mas/mas-cli/Commands/Account.swift

29 lines
715 B
Swift
Raw Normal View History

//
// 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:
if let account = ISStoreAccount.primaryAccount {
2015-09-14 08:51:09 +00:00
print(account.identifier)
}
else {
2015-09-14 08:51:09 +00:00
print("Not signed in")
exit(MASErrorCode.NotSignedIn.exitCode)
}
default:
break
}
2015-09-14 08:51:09 +00:00
return .Success(())
}
2015-08-21 18:22:06 +00:00
}