You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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
-[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
+
5
17
## Guidelines
6
18
7
19
### Git and Pull Requests
8
20
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).
10
22
11
23
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.
12
24
@@ -90,7 +102,7 @@ If you still need a dependency, follow these guidelines:
90
102
91
103
### Bash profiles and environmental variables
92
104
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.
94
106
95
107
*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).
96
108
@@ -107,6 +119,6 @@ Remember to keep these files unchanged. All manual changes will be lost when our
107
119
108
120
Some examples to get started:
109
121
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.
Copy file name to clipboardExpand all lines: README.md
+60-23Lines changed: 60 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,57 @@
1
-
# Raycast Script Commands - Advanced
2
-
3
1
> 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.
4
2
>
5
3
> And so they're all [available here](commands#advanced). 🎉
<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
+
7
32
[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.
-[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
+
13
50
## Awesome Script Commands
14
51
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.
16
53
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.
18
55
19
56
## Install Script Commands
20
57
@@ -25,23 +62,23 @@ To install new commands, follow these steps:
25
62
3. Click `Add More Directories`
26
63
4. Select the Script Command that you want to install
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).
31
68
32
69
## How to use this repository
33
70
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).
35
72
36
73
**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.
37
74
38
75
## Write Script Commands
39
76
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.
41
78
42
79
1. Create a new directory for your commands
43
80
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))
45
82
4. Duplicate the generated template and remove ".template." from the file name
46
83
5. Write your script
47
84
6. Press `Reload` in the Script Commands preferences
@@ -64,7 +101,7 @@ The following parameters are available to customize your Script Command in Rayca
64
101
| currentDirectoryPath | Path from which the script is executed. Default is the path of the script. | No | 0.29+ |
65
102
| 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+ |
66
103
| 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+ |
68
105
| author | Define an author name to be part of the script commands documentation | No ||
69
106
| authorURL | Author social media, website, email or anything to help the users to get in touch | No ||
70
107
| 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
74
111
75
112
### Standard Output
76
113
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.
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.
82
119
83
120
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
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:
| 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+ |
94
131
| 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+ |
97
134
98
135
**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))
99
136
@@ -115,13 +152,13 @@ Here's an example of a simple web search script with two arguments:
115
152
open "https://www.google.com/search?q=flights%20from%20$1%20to%20$2"
116
153
```
117
154
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.
119
156
120
157
*💡Pro tip:* When typing alias + space, Raycast automatically will move focus to the first input field.
121
158
122
159
### Error Handling
123
160
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:
125
162
```bash
126
163
if! [[ $value=~$regex ]] ;then
127
164
echo"Invalid value provided"
@@ -135,18 +172,18 @@ else
135
172
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.
136
173
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.
137
174
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).**
139
176
140
177
## Troubleshooting
141
178
142
179
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>`
144
181
* Filename doesn't contain `.template.` string
145
182
* All required metadata parameters are provided. See the table above which parameters are required.
146
183
* You use either `#` or `//` comments for metadata parameters
147
184
* You have reloaded the scripts, via 1) the "Reload" button in preferences or 2), the "Reload Script Directories"commandin root search (v0.33+), or 3) automatically via the activated "Auto Reload" feature in preferences (v0.33+)
148
185
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.
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")
0 commit comments