diff --git a/README.md b/README.md index 650ed46..8ddb858 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/). For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter). -_1753 TILs and counting..._ +_1754 TILs and counting..._ See some of the other learning resources I work on: @@ -763,6 +763,7 @@ If you've learned something here, support my efforts writing daily TILs by - [List The Files Being Loaded By Mise](mise/list-the-files-being-loaded-by-mise.md) - [Look In Ruby Version Dotfile](mise/look-in-ruby-version-dotfile.md) - [Override Your Project Mise File](mise/override-your-project-mise-file.md) +- [Pick From Tasks Using Interactive Picker](mise/pick-from-tasks-using-interactive-picker.md) - [Preserve Color Output For Task Command](mise/preserve-color-output-for-task-command.md) - [Read Existing Dot Env File Into Env Vars](mise/read-existing-dot-env-file-into-env-vars.md) - [Run A Command With Specific Tool Version](mise/run-a-command-with-specific-tool-version.md) diff --git a/mise/pick-from-tasks-using-interactive-picker.md b/mise/pick-from-tasks-using-interactive-picker.md new file mode 100644 index 0000000..181b3c4 --- /dev/null +++ b/mise/pick-from-tasks-using-interactive-picker.md @@ -0,0 +1,38 @@ +# Pick From Tasks Using Interactive Picker + +In [Add Mise Tasks For Common Workflow +Commands](https://www.visualmode.dev/add-mise-tasks-for-common-workflow-commands), +I wrote about a set of tasks I added as shortcuts for connecting to the `rails console` in various environments. + +```toml +# mise.toml +[tasks."console:staging"] +description = "Open a Rails console on staging" +run = "ssh -t my-app-staging dokku run my-app rails console" + +[tasks."console:prod"] +description = "Open a Rails console on production" +run = "ssh -t my-app-prod dokku run my-app rails console" +``` + +When a project is configured with multiple `mise` tasks like this, we can invoke +`mise run` without any specific arguments and it will prompt you with an +interactive picker. The picker will populate with all the tasks like so: + +```bash +❯ mise run +Tasks +Select a task to run +❯ console:prod Open a Rails console on production + console:staging Open a Rails console on staging +/ +esc clear filter • enter confirm +``` + +We can navigate between the options with the arrow keys (and if we exit _filter_ +mode by hitting `esc`, then `j/k` also work to move down and up). While in +_filter_ mode, we can type into the prompt which will filter the list of +commands down to just the partial matches. + +Once we're targeting the task we want to run, we hit `enter` and the task is +executed.