mas/mas-cli/Commands/Version.swift

26 lines
640 B
Swift
Raw Normal View History

2015-09-20 10:40:55 +00:00
//
// Version.swift
// mas-cli
//
// Created by Andrew Naylor on 20/09/2015.
// Copyright © 2015 Andrew Naylor. All rights reserved.
//
struct VersionCommand: CommandType {
let verb = "version"
let function = "Print version number"
2015-09-20 10:40:55 +00:00
func run(mode: CommandMode) -> Result<(), CommandantError<MASError>> {
switch mode {
case .Arguments:
let plist = NSBundle.mainBundle().infoDictionary
if let versionString = plist?["CFBundleShortVersionString"] {
print(versionString)
}
default:
break
}
return .Success(())
}
}