Skip to content

Commit

Permalink
Update drafts extension (#14795)
Browse files Browse the repository at this point in the history
* Update drafts extension

- update package manifest with quick capture command
- add quick capture command to record a new draft
- add quick capture command to README
- update Changelog with quick capture command addition

* Update drafts extension

- update all references to command Quick Capture to Capture, based on
  feedback from extension author
  • Loading branch information
wmorgano authored Oct 11, 2024
1 parent 171afc9 commit bec247d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extensions/drafts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Drafts Changelog

## [Add Command for Capture] - 2024-10-04

- Add command to capture Draft from command argument

## [Add Commands for Background creation] - 2024-09-26

- Add commands to create Draft in the background
Expand Down
4 changes: 4 additions & 0 deletions extensions/drafts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ It supports the following features as commands:

Create drafts in a Raycast form with tags (either with opening it afterwards or in the background).

## Capture Draft

Quickly capture content from command argument into a new draft in the background.

## Append/Prepend to Draft

Configure Drafts you often want to append / prepend text to.
Expand Down
18 changes: 18 additions & 0 deletions extensions/drafts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"description": "integrate Raycast with Drafts app",
"icon": "drafts-icon.png",
"author": "FlohGro",
"contributors": [
"william_morgano"
],
"categories": [
"Applications",
"Productivity"
Expand Down Expand Up @@ -115,6 +118,21 @@
"required": true
}
]
},
{
"name": "capture",
"title": "Capture Draft",
"subtitle": "Drafts",
"description": "create a new draft quickly in the background using the command argument",
"mode": "no-view",
"arguments": [
{
"name": "content",
"placeholder": "Draft Content",
"type": "text",
"required": true
}
]
}
],
"dependencies": {
Expand Down
19 changes: 19 additions & 0 deletions extensions/drafts/src/capture.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { LaunchProps, PopToRootType, showHUD } from "@raycast/api";
import { runAppleScript } from "@raycast/utils";

export default async function main(props: LaunchProps<{ arguments: Arguments.Capture }>) {
const { content } = props.arguments;

const res = await runAppleScript(
`
on run argv
tell application "Drafts"
make new draft with properties {content:argv, flagged:false}
end tell
end run
`,
[content]
);

await showHUD("Created Draft 👍", { clearRootSearch: true, popToRootType: PopToRootType.Immediate });
}

0 comments on commit bec247d

Please sign in to comment.