|
1 | 1 | # Workflows |
2 | 2 |
|
3 | | -The repo for Workflows that appear within Warp and within [commands.dev](https://www.commands.dev/) |
| 3 | +The repo for all _global_ Workflows that appear within Warp and within [commands.dev](https://www.commands.dev/). |
| 4 | + |
| 5 | +**To learn how to create local or repository workflows, see [our docs](https://github.com/warpdotdev/warp-internal/pull/2205).** |
| 6 | + |
| 7 | +<img width="736" alt="image" src="https://user-images.githubusercontent.com/4110292/164031239-49f0ec9e-f124-44c4-89e6-6facc9bf9a8f.png"> |
| 8 | + |
4 | 9 |
|
5 | 10 | ## What are Workflows? |
6 | 11 |
|
7 | 12 | Workflows are an easier way to execute and share commands within Warp. They are searchable by name, description, or command and are easily parameterized. See our documentation for more details: [https://docs.warp.dev/features/workflows](https://docs.warp.dev/features/workflows) |
8 | 13 |
|
9 | | -## How Do I Access Workflows? |
| 14 | +## How Do I Access Workflows within Warp? |
10 | 15 |
|
11 | | -Workflows can be accessed within Warp directly within the app, either through the Command Palette or by pressing `ctrl-shift-r`. |
| 16 | +Workflows can be accessed directly within Warp, either through the Command Palette or by pressing `ctrl-shift-r`. |
12 | 17 |
|
13 | 18 | All public workflows (i.e. workflows within this repo) are also available at [commands.dev](https://www.commands.dev/). |
14 | 19 |
|
15 | 20 | ## Contributing |
16 | | - |
17 | 21 | Contributions are always welcome! If you have a workflow that would be useful to many Warp users, feel free to send a PR to add a Workflow spec. |
18 | 22 |
|
19 | | -The existing preset files should serve as an example for the format, while the a more comprehensive description of the file format is available in [FORMAT.md](FORMAT.md). Please request a review from someone on the Warp team once a PR is ready for review. |
| 23 | +All workflows are defined as YAML files within the [`specs/`](specs/) directory. |
| 24 | + |
| 25 | +### File Format |
| 26 | +A comprehensive description of the file format is available in [FORMAT.md](FORMAT.md). |
| 27 | +Additionally, see the workflow below as an example to quickly get started: |
| 28 | + |
| 29 | +```yaml |
| 30 | +--- |
| 31 | +# The name of the workflow. |
| 32 | +name: Uninstall a Homebrew package and all of its dependencies |
| 33 | +# The corresponding command for the workflow. Any arguments should be surrounded with two curly braces. E.g `command {{arg}}`. |
| 34 | +command: "brew tap beeftornado/rmtree\nbrew rmtree {{package_name}}" |
| 35 | +# Any tags that workflow should be categorized with. |
| 36 | +tags: |
| 37 | + - homebrew |
| 38 | +# A description the workflow. |
| 39 | +description: Uses the external command rmtree to remove a Homebrew package and all of its dependencies |
| 40 | +# List of arguments within the command. |
| 41 | +arguments: |
| 42 | + # Name of the argument within the command. This must match exactly with the name |
| 43 | + # of the argument within the command (without the curly braces). |
| 44 | + - name: package_name |
| 45 | + # The description of the argument. |
| 46 | + description: The name of the package that should be removed |
| 47 | + # The default value for the argument. |
| 48 | + default_value: ~ |
| 49 | +# The source URL for where the workflow was generated from, if any. |
| 50 | +source_url: "https://stackoverflow.com/questions/7323261/uninstall-remove-a-homebrew-package-including-all-its-dependencies" |
| 51 | +# The author of the workflow. |
| 52 | +author: Ory Band |
| 53 | +# The URL of original author of the Workflow. For example, if this workflow was generated from StackOverflow, the `author_url` would be the StackOverflow author's profile page. |
| 54 | +author_url: "https://stackoverflow.com/users/207894" |
| 55 | +# The valid shells where this workflow should be active. If valid for all shells, this can be left empty. |
| 56 | +shells: [] |
| 57 | +``` |
| 58 | +
|
| 59 | +### Testing |
| 60 | +To test a workflow within Warp before submitting, you can use it as a local workflow within warp. |
| 61 | +
|
| 62 | +To do this: |
| 63 | +1) Copy the workflow to your local `~/.warp/workflows` directory: |
| 64 | + ```bash |
| 65 | + mkdir -p ~/.warp/workflows && cp {{workflow}}.yaml; ~/.warp/workflows/ |
| 66 | + ``` |
| 67 | +2) Open Warp and open workflows by pressing `ctrl-shift-r` or using the command palette. |
| 68 | +3) Click on "My Workflows" on the left to filter for local workflows. |
| 69 | + |
| 70 | +4) Click on the workflow you've added and ensure all the information is correct. |
| 71 | + |
| 72 | +To quickly test if a workflow file format is valid, you can also build workflows locally to validate the schema is correct: |
| 73 | +``` |
| 74 | +# Download the rust toolchain, if not already installed. |
| 75 | +brew install rust-up |
| 76 | +rustup-init |
| 77 | +
|
| 78 | +# Ensure the workflows can successfully be converted into Rust. |
| 79 | +cargo build |
| 80 | +``` |
| 81 | + |
| 82 | + |
| 83 | +### What Makes a Useful Workflow? |
| 84 | +A good workflow is one that includes a command with many flags or arguments or one that is hard to remember. |
| 85 | + |
| 86 | +Additionally, a workflow should include: |
| 87 | + |
| 88 | +* A descriptive title the includes the name of the command. |
| 89 | +* A description for the workflow and each of its argument, if applicable. |
| 90 | +* A default value for each argument, if applicable. |
0 commit comments