-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
381 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
OpenInTerminalCore/Editors/EditorApps/JetBrains/AppCodeApp.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// AppCodeApp.swift | ||
// OpenInTerminalCore | ||
// | ||
// Created by Jianing Wang on 2020/5/24. | ||
// Copyright © 2020 Jianing Wang. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
final class AppCodeApp: Editor { | ||
|
||
func open(_ path: String) throws { | ||
|
||
guard let url = URL(string: path) else { | ||
throw OITError.wrongUrl | ||
} | ||
|
||
let source = """ | ||
do shell script "open -a AppCode \(url.path.specialCharEscaped)" | ||
""" | ||
|
||
let script = NSAppleScript(source: source)! | ||
|
||
var error: NSDictionary? | ||
|
||
script.executeAndReturnError(&error) | ||
|
||
if error != nil { | ||
throw OITError.cannotAccessApp(EditorType.appCode.rawValue) | ||
} | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
OpenInTerminalCore/Editors/EditorApps/JetBrains/CLionApp.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// CLionApp.swift | ||
// OpenInTerminalCore | ||
// | ||
// Created by Jianing Wang on 2020/5/24. | ||
// Copyright © 2020 Jianing Wang. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
final class CLionApp: Editor { | ||
|
||
func open(_ path: String) throws { | ||
|
||
guard let url = URL(string: path) else { | ||
throw OITError.wrongUrl | ||
} | ||
|
||
let source = """ | ||
do shell script "open -a CLion \(url.path.specialCharEscaped)" | ||
""" | ||
|
||
let script = NSAppleScript(source: source)! | ||
|
||
var error: NSDictionary? | ||
|
||
script.executeAndReturnError(&error) | ||
|
||
if error != nil { | ||
throw OITError.cannotAccessApp(EditorType.cLion.rawValue) | ||
} | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
OpenInTerminalCore/Editors/EditorApps/JetBrains/GoLandApp.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// GoLandApp.swift | ||
// OpenInTerminalCore | ||
// | ||
// Created by Jianing Wang on 2020/5/24. | ||
// Copyright © 2020 Jianing Wang. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
final class GoLandApp: Editor { | ||
|
||
func open(_ path: String) throws { | ||
|
||
guard let url = URL(string: path) else { | ||
throw OITError.wrongUrl | ||
} | ||
|
||
let source = """ | ||
do shell script "open -a GoLand \(url.path.specialCharEscaped)" | ||
""" | ||
|
||
let script = NSAppleScript(source: source)! | ||
|
||
var error: NSDictionary? | ||
|
||
script.executeAndReturnError(&error) | ||
|
||
if error != nil { | ||
throw OITError.cannotAccessApp(EditorType.goLand.rawValue) | ||
} | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
OpenInTerminalCore/Editors/EditorApps/JetBrains/InterlliJIDEAApp.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// InterlliJIDEAApp.swift | ||
// OpenInTerminalCore | ||
// | ||
// Created by Jianing Wang on 2020/5/24. | ||
// Copyright © 2020 Jianing Wang. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
final class InterlliJIDEAApp: Editor { | ||
|
||
func open(_ path: String) throws { | ||
|
||
guard let url = URL(string: path) else { | ||
throw OITError.wrongUrl | ||
} | ||
|
||
let source = """ | ||
do shell script "open -a InterlliJ\\\\ IDEA \(url.path.specialCharEscaped)" | ||
""" | ||
|
||
let script = NSAppleScript(source: source)! | ||
|
||
var error: NSDictionary? | ||
|
||
script.executeAndReturnError(&error) | ||
|
||
if error != nil { | ||
throw OITError.cannotAccessApp(EditorType.intelliJIDEA.rawValue) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
OpenInTerminalCore/Editors/EditorApps/JetBrains/PyCharmApp.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// PyCharmApp.swift | ||
// OpenInTerminalCore | ||
// | ||
// Created by Jianing Wang on 2020/5/24. | ||
// Copyright © 2020 Jianing Wang. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
final class PyCharmApp: Editor { | ||
|
||
func open(_ path: String) throws { | ||
|
||
guard let url = URL(string: path) else { | ||
throw OITError.wrongUrl | ||
} | ||
|
||
let source = """ | ||
do shell script "open -a PyCharm \(url.path.specialCharEscaped)" | ||
""" | ||
|
||
let script = NSAppleScript(source: source)! | ||
|
||
var error: NSDictionary? | ||
|
||
script.executeAndReturnError(&error) | ||
|
||
if error != nil { | ||
throw OITError.cannotAccessApp(EditorType.pyCharm.rawValue) | ||
} | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
OpenInTerminalCore/Editors/EditorApps/JetBrains/RubyMineApp.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// RubyMineApp.swift | ||
// OpenInTerminalCore | ||
// | ||
// Created by Jianing Wang on 2020/5/24. | ||
// Copyright © 2020 Jianing Wang. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
final class RubyMineApp: Editor { | ||
|
||
func open(_ path: String) throws { | ||
|
||
guard let url = URL(string: path) else { | ||
throw OITError.wrongUrl | ||
} | ||
|
||
let source = """ | ||
do shell script "open -a RubyMine \(url.path.specialCharEscaped)" | ||
""" | ||
|
||
let script = NSAppleScript(source: source)! | ||
|
||
var error: NSDictionary? | ||
|
||
script.executeAndReturnError(&error) | ||
|
||
if error != nil { | ||
throw OITError.cannotAccessApp(EditorType.rubyMine.rawValue) | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.