warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.11k stars 360 forks source link

Workflow options or default arguments #997

Open vgarvardt opened 2 years ago

vgarvardt commented 2 years ago

Discord username (optional)

No response

Describe the solution you'd like?

Workflows are really great idea - already migrated almost all my code snippets from notes. But one feature is missing for me - predefined options for an argument.

E.g., I have several snippets like this:

---
name: AWS SSO Login <profile-name>
command: "aws sso login --profile <profile-name>"
tags: [aws, sso]
description: "Login to AWS <profile-name>"
arguments: []

with around 10 predefined profiles. Currently I can either create 10 workflows, or define profile name as an argument, but then I need to remember all of them and type them manually. Yes, autocomplete will help me the second time, but anyway free-type input does not make any sense in this case.

It would be great to have arguments.options field with the list of pre-defined values that will be available when selecting a workflow, so for the example above it will be something like

---
name: AWS SSO Login
command: "aws sso login --profile {{profile-name}}"
tags: [aws, sso]
description: "Login to AWS profile"
arguments:
  - name: profile-name
    description: AWS profile name
    options: [ foo, bar, baz ]

This is just one of the examples, I have several commands like this with limited list of arguments that are currently duplicated as several workflows with predefined commands for every possible input.

horbo commented 2 years ago

Yes! I would even expand options value to contain labels too, like:

---
name: AWS SSO Login
command: "aws sso login --profile {{profile-name}}"
tags: [aws, sso]
description: "Login to AWS profile"
arguments:
  - name: profile-name
    description: AWS profile name
    options:
      - label: label1
        value: value1
      - label: label2
        value: value2 

It would be helpful for UUID-like values.

elviskahoro commented 2 years ago

Gonna flag this again to the team

tchamberland commented 2 years ago

came here looking to see if this feature existed or was already requested - glad to see I'm not the only one that would like this feature.

My use-case is that I have a bunch of database server urls that I would love to be able to add into my workflows and choose which database to connect to via workflow arguments. I have +10 postgresql databases each with unique URLs that I work with so having the urls as options available in the workflow itself would be awesome.

There is a bit of structure to the URLs but we cannot "template" them completely because each one has a unique part in their URL that is basically just random characters, for example: test-db-1.dj8ax1brwtms.us-west-2.rds.amazonaws.com

@horbo 's suggestion is pretty much exactly what I would want, a value and a label - and way to choose the option in the warp workflow ui, possibly even have an extra key in the argument structure to specify which option is the default. Always defaulting to the first one would also be fine too.

arguments:
  - name: profile-name
    description: AWS profile name
    default: 0
    options:
      - label: label1
        value: value1
      - label: label2
        value: value2 
dannyneira commented 1 year ago

Please +1 this request as it helps us gauge interest. We will post any updates here.

Some great suggestions for the same in #2176

dannyneira commented 1 year ago

user comment:

It's great to save workflows that have variable arguments. If this isn't currently doable, it would be great if there was a way of saving common values used for those arguments and selecting which values to use with a given workflow.

dannyneira commented 1 month ago

Hey Folks and @vgarvardt, we recently launched Enums in Warp Drive Workflows which allows for a list of default options. Please let us know if this helps with your use case.

agrohs commented 1 month ago

Incredibly excited for the new enum feature...huge kudos on adding this!! +1 for labels on each value in the enums +1 for choosing a "default" to an enum value for a specific workflow

cc: @rsbowers