Skip to content

Commit a18b11a

Browse files
authored
Merge pull request #5 from function-artisans/fix-json-shortcut
Copy the shortcut result with pbcopy
2 parents 50c1630 + cdca907 commit a18b11a

1 file changed

Lines changed: 3 additions & 24 deletions

File tree

‎src/shortcuts.ts‎

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ function shellCommand(language: Language, { bin, printWidth, sqlDialect }: Comma
3030
if (printWidth !== undefined) parts.push(`--print-width=${printWidth}`);
3131
if (sqlDialect && language.startsWith("sql")) parts.push(`--sql-dialect=${sqlDialect}`);
3232

33+
// Shortcuts turns a script result that looks like JSON into a dictionary and loses the format.
34+
parts.push("|", "pbcopy");
35+
3336
return parts.join(" ");
3437
}
3538

3639
function shortcutPlist(name: string, command: string): string {
3740
const scriptUUID = randomUUID().toUpperCase();
38-
const clipboardUUID = randomUUID().toUpperCase();
3941

4042
return `<?xml version="1.0" encoding="UTF-8"?>
4143
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -79,29 +81,6 @@ function shortcutPlist(name: string, command: string): string {
7981
<string>${scriptUUID}</string>
8082
</dict>
8183
</dict>
82-
<dict>
83-
<key>WFWorkflowActionIdentifier</key>
84-
<string>is.workflow.actions.setclipboard</string>
85-
<key>WFWorkflowActionParameters</key>
86-
<dict>
87-
<key>UUID</key>
88-
<string>${clipboardUUID}</string>
89-
<key>WFInput</key>
90-
<dict>
91-
<key>Value</key>
92-
<dict>
93-
<key>OutputName</key>
94-
<string>Shell Script Result</string>
95-
<key>OutputUUID</key>
96-
<string>${scriptUUID}</string>
97-
<key>Type</key>
98-
<string>ActionOutput</string>
99-
</dict>
100-
<key>WFSerializationType</key>
101-
<string>WFTextTokenAttachment</string>
102-
</dict>
103-
</dict>
104-
</dict>
10584
</array>
10685
</dict>
10786
</plist>

0 commit comments

Comments
 (0)