From 7388fbe2345ef96446dc3ebdc94411d46bc99ad4 Mon Sep 17 00:00:00 2001 From: Alex Cidon Date: Sat, 27 Jan 2024 20:55:19 -0500 Subject: [PATCH] Added option to create new instance --- Sources/CodeEditCLI/Open.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sources/CodeEditCLI/Open.swift b/Sources/CodeEditCLI/Open.swift index fd988e4..ad43d72 100644 --- a/Sources/CodeEditCLI/Open.swift +++ b/Sources/CodeEditCLI/Open.swift @@ -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. @@ -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) @@ -43,7 +47,11 @@ extension CodeEditCLI { } else { task.arguments = ["-a", "CodeEdit.app"] } - + + if newWindow { + task.arguments?.append("-n") + } + try task.run() }