Main // Use switch to manage incoming commandline arguments.
This commit is contained in:
parent
53c72f4092
commit
62a41f4ea9
|
@ -29,16 +29,31 @@ import InputMethodKit
|
|||
|
||||
let kConnectionName = "vChewing_1_Connection"
|
||||
|
||||
if CommandLine.arguments.count > 1 {
|
||||
switch max(CommandLine.arguments.count - 1, 0) {
|
||||
case 0: break
|
||||
case 1, 2:
|
||||
do {
|
||||
switch CommandLine.arguments[1] {
|
||||
case "install":
|
||||
do {
|
||||
if CommandLine.arguments[1] == "install" {
|
||||
let exitCode = IME.registerInputMethod()
|
||||
exit(exitCode)
|
||||
}
|
||||
}
|
||||
case "uninstall":
|
||||
do {
|
||||
if CommandLine.arguments[1] == "uninstall" {
|
||||
let exitCode = IME.uninstall(isSudo: IME.isSudoMode)
|
||||
exit(exitCode)
|
||||
}
|
||||
}
|
||||
default: break
|
||||
}
|
||||
}
|
||||
exit(0)
|
||||
default: exit(0)
|
||||
}
|
||||
|
||||
guard let mainNibName = Bundle.main.infoDictionary?["NSMainNibFile"] as? String else {
|
||||
NSLog("Fatal error: NSMainNibFile key not defined in Info.plist.")
|
||||
|
|
Loading…
Reference in New Issue