Skip to content

Commit

Permalink
feat: support open in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
oe authored Apr 28, 2022
1 parent 7e914de commit 391cc95
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Binary file modified SourceTree.alfredworkflow
Binary file not shown.
6 changes: 0 additions & 6 deletions exec.sh

This file was deleted.

8 changes: 5 additions & 3 deletions workflow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ class SourceTree: Workflow {
return
}
var list = filter(by: query)
let destFile = #file
var destFile = #file
// remove the possible extension
destFile = destFile.replacingOccurrences(of: ".swift", with: "")
let sourceFile = "\(destFile).swift"

let compileScript = AlfredItem(
Expand Down Expand Up @@ -286,10 +288,10 @@ extension SourceTree.SourceTreePlist {
}

return namePathGroups.map { (name, path) in
let cmd = Workflow.AlfredItemModItem(valid: true, arg: "open \"\(path)\"", subtitle: "Reveal in Finder")
let alt = Workflow.AlfredItemModItem(valid: true, arg: "open \"\(path)\"", subtitle: "Reveal in Finder")
// default using `code` aka VS Code to open project
let editCli = ProcessInfo.processInfo.environment["EDITOR_CLI"] ?? "code"
let alt = Workflow.AlfredItemModItem(valid: true, arg: "\(editCli) \"\(path)\"", subtitle: "Open repo in your preferred code editor")
let cmd = Workflow.AlfredItemModItem(valid: true, arg: "\(editCli) \"\(path)\"", subtitle: "Open repo in your preferred code editor")
return Workflow.AlfredItem(title: name, subtitle: path, arg: path, mods: Workflow.AlfredMods(cmd: cmd, alt: alt))
}
}
Expand Down

0 comments on commit 391cc95

Please sign in to comment.