diff --git a/uPic.xcodeproj/project.pbxproj b/uPic.xcodeproj/project.pbxproj index aac8b977..2093743a 100644 --- a/uPic.xcodeproj/project.pbxproj +++ b/uPic.xcodeproj/project.pbxproj @@ -1199,7 +1199,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 20200109; + CURRENT_PROJECT_VERSION = 20200110; DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; @@ -1208,7 +1208,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.12; - MARKETING_VERSION = 0.16.2; + MARKETING_VERSION = 0.16.4; PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -1229,7 +1229,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 20200109; + CURRENT_PROJECT_VERSION = 20200110; DEVELOPMENT_TEAM = W863J6W8DZ; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "$(SRCROOT)/uPic/Supporting Files/Info.plist"; @@ -1238,7 +1238,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.12; - MARKETING_VERSION = 0.16.2; + MARKETING_VERSION = 0.16.4; PRODUCT_BUNDLE_IDENTIFIER = com.svend.uPic; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/uPic/Cli/Cli.swift b/uPic/Cli/Cli.swift index c761af8e..efe55f18 100644 --- a/uPic/Cli/Cli.swift +++ b/uPic/Cli/Cli.swift @@ -30,7 +30,7 @@ class Cli { private var resultUrls: [String] = [] func handleCommandLine() -> Bool { - let arguments = clearMacosAppTakeParameters() + let arguments = CommandLine.arguments guard arguments.count > 1 else { return false } cliKit = CommandLineKit(arguments: arguments) @@ -39,7 +39,7 @@ class Cli { allDataList = [] resultUrls = [] - upload = MultiStringOption(shortFlag: "u", longFlag: "upload", helpMessage: "Path and URL of the file to upload".localized) + upload = MultiStringOption(shortFlag: "u", longFlag: "upload", required: true, helpMessage: "Path and URL of the file to upload".localized) output = StringOption(shortFlag: "o", longFlag: "output", helpMessage: "Output url format".localized) slient = BoolOption(shortFlag: "s", longFlag: "slient", helpMessage: "Turn off error message output".localized) help = BoolOption(shortFlag: "h", longFlag: "help", helpMessage: "Print this help message".localized) @@ -48,47 +48,18 @@ class Cli { try cliKit.parse() } catch { cliKit.printUsage(error) - exit(EX_USAGE) + return false } if let paths = upload.value { startUpload(paths) return true - } else if output.value != nil { - cliKit.printUsage() - exit(EX_USAGE) - } else if slient.value { - cliKit.printUsage() - exit(EX_USAGE) - } else if help.value { - cliKit.printUsage() - exit(EX_USAGE) - } else { + } else { cliKit.printUsage() } return false } - - private func clearMacosAppTakeParameters() -> [String] { - let arguments = ProcessInfo.processInfo.arguments - var cleardArguments: [String] = [] - - var dropNextArg = false - for arg in arguments { - if dropNextArg { - dropNextArg = false - continue - } - if arg.hasPrefix("-NS") || arg.hasPrefix("-Apple") || arg.hasPrefix("--Apple") { - dropNextArg = true - } else { - cleardArguments.append(arg) - } - } - - return cleardArguments - } } // MARK: - Upload