Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Sources/CodeEditCLI/Open.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ extension CodeEditCLI {
abstract: "A command-line tool to open files/folders in CodeEdit.app."
)

@Flag(name: .shortAndLong, help: "Open the editor in a new instance.")
private var newWindow = false

@Argument(
help: """
The path of a file/folder to open.
Expand All @@ -30,6 +33,7 @@ extension CodeEditCLI {
// use the `open` cli as the executable
task.launchPath = "/usr/bin/open"


if let path {
let (path, line, column) = try extractLineColumn(path)
let openURL = try absolutePath(path, for: task)
Expand All @@ -43,7 +47,11 @@ extension CodeEditCLI {
} else {
task.arguments = ["-a", "CodeEdit.app"]
}


if newWindow {
task.arguments?.append("-n")
}

try task.run()
}

Expand Down