     let commandShortDescription = "Terminate the specified running app. You need to pass the exact bundleID or PID."
     let commandSignature = ""
 
+    var pid:Int?
+    var bundleId:String?
+
     func setupOptions(options: Options) {
         options.onKeys(["-p", "--pid"]) { [unowned self] _, value in
             guard let pid = Int(value) else {
                 print("invalid pid: \(value)")
                 return
             }
+            self.pid = pid
+        }
+        options.onKeys(["-b", "--bundle-id"]) { [unowned self] _, value in
+            self.bundleId = value
+        }
+    }
+    func terminate(app:NSRunningApplication) {
+        print("Terminating \(app.bundleIdentifier ?? UnknownBundleID): \(app.processIdentifier) ...")
+        app.terminate()
+    }
+    enum SniperError: ErrorType {
+        case InvalidArgument
+    }
+    func execute(arguments: CommandArguments) throws  {
+        if let _ = pid, _ = bundleId {
+            print("Cannot specify both bundleID(-b) and PID(-p) at the same time.")
+            throw SniperError.InvalidArgument
+        }
+        if let pid = pid {
             let apps = NSWorkspace.sharedWorkspace().runningApplications
             let filtered = apps.filter {
                 Int($0.processIdentifier) == pid

            }
            apps.forEach(self.terminate)
        }
    }
    func terminate(app:NSRunningApplication) {
        print("Terminating \(app.bundleIdentifier ?? UnknownBundleID): \(app.processIdentifier) ...")
        app.terminate()
    }
    func execute(arguments: CommandArguments) throws  {
    }
}



    func execute(arguments: CommandArguments) throws  {
        let keyword = arguments.optionalArgument("keyword")
        let apps = getApps(keyword)
        print("\(apps.count) app\(apps.count == 1 ? "" : "s") found.")
        for app in apps {
            print("\(app.bundleIdentifier ?? UnknownBundleID): \(app.processIdentifier)")
        }
    }
    func getApps(keyword:String? = nil) -> [NSRunningApplication] {
        let apps = NSWorkspace.sharedWorkspace().runningApplications
        switch keyword {
        case .None:
            return apps
        case .Some(let keyword):
            let regex = try! NSRegularExpression(pattern: "\(keyword)", options: .CaseInsensitive)
            return apps.filter{
                guard let bundle = $0.bundleIdentifier else {
                    return false
                }
