2015-09-20 11:40:55 +01:00
|
|
|
//
|
|
|
|
// Version.swift
|
|
|
|
// mas-cli
|
|
|
|
//
|
|
|
|
// Created by Andrew Naylor on 20/09/2015.
|
|
|
|
// Copyright © 2015 Andrew Naylor. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2018-07-04 14:56:10 -06:00
|
|
|
import Commandant
|
|
|
|
|
2018-12-28 15:08:31 -07:00
|
|
|
/// Command which displays the version of the mas tool.
|
2018-10-14 15:35:48 -06:00
|
|
|
public struct VersionCommand: CommandProtocol {
|
|
|
|
public typealias Options = NoOptions<MASError>
|
|
|
|
public let verb = "version"
|
|
|
|
public let function = "Print version number"
|
|
|
|
|
|
|
|
public init() {}
|
|
|
|
|
2019-01-11 18:28:03 -07:00
|
|
|
/// Runs the command.
|
2019-01-29 23:15:24 -07:00
|
|
|
public func run(_: Options) -> Result<(), MASError> {
|
2016-09-17 13:58:38 +01:00
|
|
|
let plist = Bundle.main.infoDictionary
|
2015-12-30 21:20:25 +00:00
|
|
|
if let versionString = plist?["CFBundleShortVersionString"] {
|
|
|
|
print(versionString)
|
2015-09-20 11:40:55 +01:00
|
|
|
}
|
2016-09-17 13:58:38 +01:00
|
|
|
return .success(())
|
2015-09-20 11:40:55 +01:00
|
|
|
}
|
|
|
|
}
|