Skip to content

Commit 3942f3d

Browse files
committed
Merge branch 'raycast/master'
* raycast/master: (146 commits) Update Script Commands documentation README: Fix some typos Set scripts as executable Add a Bitwarden package (raycast#214) Update Script Commands documentation add Peekalink script (raycast#216) Update Script Commands documentation Add a script command to run an arbitrary shell command in iTerm (raycast#215) 🩹 Make requests PR changes. 🔥 Remove duplicate header ✨ Add table of contents ♻️ Refactor all markdown links to use local routes 📝 Add a nice looking README header Update Script Commands documentation Add documentation metadata to the Kinopoisk script command Add a script command for searching in Kinopoisk Add a script command for searching in App Store app Update Script Commands documentation Fix decimal date calculation close system preferences once audio output is switched ... # Conflicts: # README.md # commands/README.md # commands/extensions.json
2 parents 5ee4185 + b2f2d2a commit 3942f3d

File tree

121 files changed

+2320
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+2320
-42
lines changed

CONTRIBUTING.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22

33
Thank you for your interest in contributing to Raycast Script Commands! Here you will find simple guidelines that can help you with getting started.
44

5+
- [Contributing](#contributing)
6+
- [Guidelines](#guidelines)
7+
- [Git and Pull Requests](#git-and-pull-requests)
8+
- [Folder structure](#folder-structure)
9+
- [File naming convention](#file-naming-convention)
10+
- [Metadata convention](#metadata-convention)
11+
- [Scripts that require additional modification](#scripts-that-require-additional-modification)
12+
- [Scripts that require installation of runtimes and dependencies](#scripts-that-require-installation-of-runtimes-and-dependencies)
13+
- [Bash profiles and environmental variables](#bash-profiles-and-environmental-variables)
14+
- [Auto generated files](#auto-generated-files)
15+
- [Examples](#examples)
16+
517
## Guidelines
618

719
### Git and Pull Requests
820

9-
Please make sure that your pull request makes it easy for the reviewer to understand what the change is about (fill in the pull request template) and keep your change focused (do not create a PR containing multiple complex script commands).
21+
Please make sure that your pull request makes it easy for the reviewer to understand what the change is about (fill in the pull request template) and keep your change focused (do not create a PR containing multiple complex Script Commands).
1022

1123
In order to keep the Git history clean, we prefer if you rebase your branch on top of master, so that we can do a fast-forward merge back to master. Make sure to use descriptive commit messages (incl. proper spelling), and squash commits ("fix typo") already on your end.
1224

@@ -90,7 +102,7 @@ If you still need a dependency, follow these guidelines:
90102

91103
### Bash profiles and environmental variables
92104

93-
All Script Commands are executed in a non-login shell to avoid additional information loaded from profiles that aren't relevant to Raycast. With an argument after a shebang, you can run a script in a login shell, e.g. `#!/bin/bash -l`. We don't allow Script Commands that make use of this feature in this repository. Mainly to guarantee easy portability, explicit injection of information and best performance.
105+
All Script Commands are executed in a non-login shell to avoid additional information loaded from profiles that aren't relevant to Raycast. With an argument after a shebang, you can run a script in a login shell, e.g. `#!/bin/bash -l`. We don't allow Script Commands that make use of this feature in this repository. Mainly to guarantee easy portability, explicit injection of information and best performance.
94106

95107
*NOTE:* We will add support for environmental variables in Raycast and keep track of it in [this issue](https://github.com/raycast/script-commands/issues/77).
96108

@@ -107,6 +119,6 @@ Remember to keep these files unchanged. All manual changes will be lost when our
107119

108120
Some examples to get started:
109121

110-
- **[Apple Music Play](https://github.com/raycast/script-commands/blob/master/commands/media/apple-music/apple-music-play.applescript)**: An `AppleScript` to start playing music.
111-
- **[Sentry Unresolved Issues](https://github.com/raycast/script-commands/blob/master/commands/developer-utils/sentry/sentry-unresolved-issues.template.py):** A `Python` script that fetches information from an API and parses the JSON response.
112-
- **[Slack Set Status](https://github.com/raycast/script-commands/blob/master/commands/communication/slack/set-slack-status.template.sh)**: A `Bash` script that sends a JSON payload with cURL.
122+
- **[Apple Music Play](commands/media/apple-music/apple-music-play.applescript)**: An `AppleScript` to start playing music.
123+
- **[Sentry Unresolved Issues](commands/developer-utils/sentry/sentry-unresolved-issues.template.py):** A `Python` script that fetches information from an API and parses the JSON response.
124+
- **[Slack Set Status](commands/communication/slack/set-slack-status.template.sh)**: A `Bash` script that sends a JSON payload with cURL.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Raycast Technologies Ltd.
3+
Copyright (c) 2020-2021 Raycast Technologies Ltd.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,57 @@
1-
# Raycast Script Commands - Advanced
2-
31
> Many of the Script Commands I was submitting to [raycast/script-commands](https://github.com/raycast/script-commands) were deemed "too advanced" and so were rejected.
42
>
53
> And so they're all [available here](commands#advanced). 🎉
64
5+
<div align="center">
6+
<a href="https://raycast.com">
7+
<img src="./images/logo.png" height="250px">
8+
</a>
9+
10+
<br/>
11+
<br/>
12+
<h1>Raycast Script Commands</h1>
13+
14+
<!-- Images -->
15+
<a href="https://github.com/raycast/script-commands/graphs/contributors">
16+
<img alt="GitHub contributors" src="https://img.shields.io/github/contributors/raycast/script-commands">
17+
</a>
18+
<a href="https://twitter.com/raycastapp">
19+
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/raycastapp?style=social">
20+
</a>
21+
<a href="https://github.com/raycast/script-commands/stargazers">
22+
<img alt="GitHub Org's stars" src="https://img.shields.io/github/stars/raycast?style=social">
23+
</a>
24+
25+
<br/>
26+
<br/>
27+
<i>Script Commands lets you tailor Raycast to your needs. <br/> Think of them as little productivity boosts throughout your day.</i>
28+
</div>
29+
30+
<hr>
31+
732
[Raycast](https://raycast.com) lets you control your tools with a few keystrokes and Script Commands makes it possible to execute scripts from anywhere on your desktop. They are a great way to speed up every-day tasks such as converting data, opening bookmarks or triggering dev workflows.
833

9-
![Demo](https://github.com/raycast/script-commands/blob/master/screenshots/demo.gif?raw=true)
34+
![Demo](images/screenshots/demo.gif)
1035

1136
This repository contains sample commands, community commands, and documentation to write your own ones.
1237

38+
- [Awesome Script Commands](#awesome-script-commands)
39+
- [Install Script Commands](#install-script-commands)
40+
- [How to use this repository](#how-to-use-this-repository)
41+
- [Write Script Commands](#write-script-commands)
42+
- [API](#api)
43+
- [Standard Output](#standard-output)
44+
- [Passing Arguments](#passing-arguments)
45+
- [Error Handling](#error-handling)
46+
- [Login Shell and `$PATH`](#login-shell-and-path)
47+
- [Troubleshooting](#troubleshooting)
48+
- [Community](#community)
49+
1350
## Awesome Script Commands
1451

15-
You can find a lot of [useful script commands built by our community](https://github.com/raycast/script-commands/tree/master/commands) here.
52+
You can find a lot of [useful Script Commands built by our community](commands/) here.
1653

17-
Want to contribute? What a brilliant idea, please see this [contribution guide](https://github.com/raycast/script-commands/blob/master/CONTRIBUTING.md), it will help you with getting started.
54+
Want to contribute? What a brilliant idea, please see this [contribution guide](CONTRIBUTING.md), it will help you with getting started.
1855

1956
## Install Script Commands
2057

@@ -25,23 +62,23 @@ To install new commands, follow these steps:
2562
3. Click `Add More Directories`
2663
4. Select the Script Command that you want to install
2764

28-
![Preferences](https://github.com/raycast/script-commands/blob/master/screenshots/preferences.png?raw=true)
65+
![Preferences](images/screenshots/preferences.png)
2966

30-
To get started, download one of the sample commands in this repository or [write a custom script](https://github.com/raycast/script-commands/blob/master/README.md#write-script-commands).
67+
To get started, download one of the sample commands in this repository or [write a custom Script Command](#write-script-commands).
3168

3269
## How to use this repository
3370

34-
Grab scripts that you want to use and copy them to a separate directory on your machine (you can use the [_enabled-commands](https://github.com/raycast/script-commands/blob/master/_enabled-commands) folder from this repo for this).
71+
Grab scripts that you want to use and copy them to a separate directory on your machine (you can use the [_enabled-commands](_enabled-commands/) folder from this repo for this).
3572

3673
**Note**: We recommend against directly using script directories from this repo in Raycast to protect yourself from potential restructuring and new script commands suddenly appearing in Raycast.
3774

3875
## Write Script Commands
3976

40-
To write your custom Script Commands, go over the following steps and follow the [troubleshooting section](https://github.com/raycast/script-commands/blob/master/README.md#troubleshooting) if your script command does not show up in Raycast.
77+
To write your custom Script Commands, go over the following steps and follow the [troubleshooting section](#troubleshooting) if your Script Command does not show up in Raycast.
4178

4279
1. Create a new directory for your commands
4380
2. Open the Extensions preferences in Raycast and select Script Commands
44-
3. Click `Add More Directories` and select your new directory (If it's empty, we generate a [template](https://github.com/raycast/script-commands/blob/master/script-command.template.sh))
81+
3. Click `Add More Directories` and select your new directory (If it's empty, we generate a [template](templates/script-command.template.sh))
4582
4. Duplicate the generated template and remove ".template." from the file name
4683
5. Write your script
4784
6. Press `Reload` in the Script Commands preferences
@@ -64,7 +101,7 @@ The following parameters are available to customize your Script Command in Rayca
64101
| currentDirectoryPath | Path from which the script is executed. Default is the path of the script. | No | 0.29+ |
65102
| needsConfirmation | Specify `true` if you would like to show confirmation alert dialog before running the script. Can be helpful with destructive scripts like "Quit All Apps" or "Empty Trash". Default value is `false`. | No | 0.30+ |
66103
| refreshTime | Specify a refresh interval for `inline` mode scripts in seconds, minutes, hours or days. Examples: `10s`, `1m`, `12h`, `1d`. Script output will be shown inline in dashboard items. *Note* that the actual times are not accurate and can vary depending on how the OS prioritizes scheduled work. The minimum allowed refresh interval is 10 seconds (use responsibly...), and the maximum allowed number of refreshing `inline` commands is 10. | No | 0.31+ |
67-
| argument[1...3] | Custom arguments, see [Passing Arguments](https://github.com/raycast/script-commands#passing-arguments) section that explains in details how to use this field | No | 1.2.0+ |
104+
| argument[1...3] | Custom arguments, see [Passing Arguments](#passing-arguments) section that explains in details how to use this field | No | 1.2.0+ |
68105
| author | Define an author name to be part of the script commands documentation | No | |
69106
| authorURL | Author social media, website, email or anything to help the users to get in touch | No | |
70107
| description | A brief description about the script command to be presented in the documentation | No | |
@@ -74,26 +111,26 @@ The following parameters are available to customize your Script Command in Rayca
74111

75112
### Standard Output
76113

77-
You can use the standard output to present messages in Raycast. Depending on the `mode`, the standard output of your scripts is differently presented.
114+
You can use the standard output to present messages in Raycast. Depending on the `mode`, the standard output of your scripts is differently presented.
78115

79-
![Toast](https://github.com/raycast/script-commands/blob/master/screenshots/toast.png?raw=true)
116+
![Toast](images/screenshots/toast.png)
80117

81118
In `fullOutput` the entire output is presented on a separate view, similar to a terminal. This is handy when your script generates output to consume. In `compact` mode the last line of the standard output is shown in the toast. And in `silent` mode the last line (if exists) will be shown in overlaying HUD toast after Raycast window is closed.
82119

83120
In `inline` mode, the first line of output will be directly shown in the command item and automatically refresh according to the specified `refreshTime`. Tip: Set your dashboard items as favorites via the action menu in Raycast
84121

85122
### Passing Arguments
86123

87-
![Custom Arguments](https://github.com/raycast/script-commands/blob/master/screenshots/custom-arguments.png?raw=true)
124+
![Custom Arguments](images/screenshots/custom-arguments.png)
88125

89-
Use `argument[1..3]` metadata to specify custom arguments that will be displayed as inputs in the search bar when the script is selected. Value of the argument metadata paratmeter should be valid json with these fields:
126+
Use `argument[1..3]` metadata to specify custom arguments that will be displayed as inputs in the search bar when the script is selected. The value of the argument metadata parameter should be valid json with these fields:
90127

91128
| Field | Description | Required | App Version |
92129
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|-------------|
93-
| type | Input type. For now only "text" value available. | Yes | 1.2.0+ |
130+
| type | Input type. For now only "text" value available. | Yes | 1.2.0+ |
94131
| placeholder | Placeholder for the input field. | Yes | 1.2.0+ |
95-
| optional | Set to `true` if you want to mark argument as optional. When not provided, argument is considered to be required (Raycast will not allow to execute the script if argument input is empty) | No | 1.3.0+ |
96-
| percentEncoded| Set to `true` if you want Raycast to perform percent encoding on the argument value before passing it to the script. Can be handy for scripts that pass argument directly to URL query | No | 1.4.0+ |
132+
| optional | Set to `true` if you want to mark the argument as optional. When not provided, the argument is considered to be required (Raycast will not allow to execute the script if the argument input is empty) | No | 1.3.0+ |
133+
| percentEncoded| Set to `true` if you want Raycast to perform percent encoding on the argument value before passing it to the script. Can be handy for scripts that pass the argument directly to URL query | No | 1.4.0+ |
97134

98135
**Maximum number of arguments:** 3 (if you feel it's not enough for your use case, please let us know via feedback or in the [Slack community](https://www.raycast.com/community))
99136

@@ -115,13 +152,13 @@ Here's an example of a simple web search script with two arguments:
115152
open "https://www.google.com/search?q=flights%20from%20$1%20to%20$2"
116153
```
117154

118-
Check the [templates](/tree/master/templates) for additional examples with other script languages.
155+
Check the [templates](templates/) for additional examples with other script languages.
119156

120157
*💡Pro tip:* When typing alias + space, Raycast automatically will move focus to the first input field.
121158

122159
### Error Handling
123160

124-
If the script exits with a status code not equal to 0, Raycast interprets it as failed and shows a toast that the script failed to run. If this script has inline or compact mode, the last line of the output will be used as an error message. Consider this example for bash script:
161+
If the script exits with a status code not equal to 0, Raycast interprets it as failed and shows a toast that the script failed to run. If this script has inline or compact mode, the last line of the output will be used as an error message. Consider this example for a bash script:
125162
```bash
126163
if ! [[ $value =~ $regex ]] ; then
127164
echo "Invalid value provided"
@@ -135,18 +172,18 @@ else
135172
The script is running in a non-login shell to avoid loading additional information from profiles. However, if you need to run your script as login-shell, you can specify an argument after shebang, e.g. `#!/bin/bash -l` for bash.
136173
We also append `/usr/local/bin` to `$PATH` variable so you can use your local shell commands without any additional steps. If this is not enough, you can always extend `$PATH` by adding `export PATH='/some/extra/path:$PATH'` at the top of your script.
137174
138-
**👮‍♂️ We only allow Script Commands that run in a non-login shell in this repository as agreed on in our [contribution guidelines](https://github.com/raycast/script-commands/blob/master/CONTRIBUTING.md).**
175+
**👮‍♂️ We only allow Script Commands that run in a non-login shell in this repository as agreed on in our [contribution guidelines](CONTRIBUTING.md).**
139176
140177
## Troubleshooting
141178
142179
If a script doesn't appear in the commands list, make sure these requirements are met:
143-
* Script file is executable (you can run `file <path to script>` command in terminal to check it). To make the script executable, run: `chmod +x <path to script>`
180+
* Script file is executable (you can run `file <path to script>` command in terminal to check it). To make the script executable, run: `chmod +x <path to script>`
144181
* Filename doesn't contain `.template.` string
145182
* All required metadata parameters are provided. See the table above which parameters are required.
146183
* You use either `#` or `//` comments for metadata parameters
147184
* You have reloaded the scripts, via 1) the "Reload" button in preferences or 2), the "Reload Script Directories" command in root search (v0.33+), or 3) automatically via the activated "Auto Reload" feature in preferences (v0.33+)
148185
149-
If nothing helps, try to go step by step from a [template](https://github.com/raycast/script-commands/blob/master/script-command.template.sh) script command or use one of the examples in this repo.
186+
If nothing helps, try to go step by step from a [template](templates/script-command.template.sh) Script Command or use one of the examples in this repo.
150187
151188
## Community
152189

Tools/Toolkit/Tests/ToolkitLibraryTests/ToolkitLibraryTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class ToolkitLibraryTests: XCTestCase {
1717
let data = pipe.fileHandleForReading.readDataToEndOfFile()
1818
let output = String(data: data, encoding: .utf8)
1919

20-
XCTAssertEqual(output, "Hello, world!\n")
20+
XCTAssertEqual(output, "OVERVIEW: A tool to generate automatized documentation\n\nUSAGE: toolkit <subcommand>\n\nOPTIONS:\n -h, --help Show help information.\n\nSUBCOMMANDS:\n generate-documentation Generate the documentation in JSON and Markdown format\n version Print the current Toolkit version\n\n See \'toolkit help <subcommand>\' for detailed help.\n")
2121
}
2222

2323
/// Returns path to the built products directory.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/osascript
2+
3+
# @raycast.title End Session
4+
# @raycast.author James Lyons
5+
# @raycast.authorURL https://github.com/jamesjlyons
6+
# @raycast.description Stop Current Amphetamine Session
7+
8+
# @raycast.icon images/amphetamine.png
9+
# @raycast.mode silent
10+
# @raycast.packageName Amphetamine
11+
# @raycast.schemaVersion 1
12+
13+
tell application "Amphetamine" to end session
14+
15+
log "Ended current session"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/osascript
2+
3+
# @raycast.title Start Default Session
4+
# @raycast.author James Lyons
5+
# @raycast.authorURL https://github.com/jamesjlyons
6+
# @raycast.description Start Default Amphetamine Session
7+
8+
# @raycast.icon images/amphetamine.png
9+
# @raycast.mode silent
10+
# @raycast.packageName Amphetamine
11+
# @raycast.schemaVersion 1
12+
13+
tell application "Amphetamine" to start new session
14+
15+
log "Started default session"
1.73 KB
Loading

0 commit comments

Comments
 (0)