From 1f12b25a9e5aa2734ce99db95a6a30a3aaa08141 Mon Sep 17 00:00:00 2001 From: Caleb Foust Date: Wed, 17 Jan 2024 05:24:10 +0800 Subject: [PATCH] feat: command palette --- docs/src/configuration.md | 4 +++- docs/src/quick-start.md | 10 ++++++++++ pkg/cy/stories.go | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/src/configuration.md b/docs/src/configuration.md index c79e1768..7949677f 100644 --- a/docs/src/configuration.md +++ b/docs/src/configuration.md @@ -1,6 +1,6 @@ # Configuration -All of `cy`'s behavior is determined using a programming language called [Janet](https://janet-lang.org/), which is a fun, embeddable [Lisp]() that is easy to learn and comes out of the box with a comprehensive standard library. If you are new to Janet, I recommend starting out with its [documentation](https://janet-lang.org/docs/syntax.html) and Ian Henry's fantastic [_Janet for Mortals_](https://janet.guide/). +All of `cy`'s behavior is determined using a programming language called [Janet](https://janet-lang.org/), which is a fun, embeddable [Lisp-like]() language that is easy to learn. If you are new to Janet, I recommend starting out with its [documentation](https://janet-lang.org/docs/syntax.html) and Ian Henry's fantastic [_Janet for Mortals_](https://janet.guide/). Janet looks like this: @@ -24,6 +24,8 @@ On startup, `cy` will search for and execute the first file containing Janet sou 1. `$HOME/.config/cyrc.janet` 1. `$HOME/.config/.cy.janet` +For now, there is no way to reload your configuration; if you make changes to your configuration file, you'll need to restart cy. + Your `cy` configuration can contain any valid Janet statement, but `cy` also provides additions to the standard library in the form of [an API](./api.md) for controlling every aspect of how `cy` works. ### Example configuration diff --git a/docs/src/quick-start.md b/docs/src/quick-start.md index 7ab69653..e9345fd6 100644 --- a/docs/src/quick-start.md +++ b/docs/src/quick-start.md @@ -110,3 +110,13 @@ The controls should be familiar to you if you have ever used a fuzzy finder: - `ctrl+a` `k`: Jump to a project. - `ctrl+a` `l`: Jump to a shell based on its current working directory. + +## 7. Using the command palette + +{{story cast cy/palette}} + +Like most modern applications, `cy` includes a command palette, which lets you search through and execute all of the available actions. You can access it by typing `ctrl+a` `ctrl+p`. + +## 8. Quitting cy + +You can kill the cy server by hitting `ctrl+a` `q` and detach from it (but leave the server running with `ctrl+a` `d`. diff --git a/pkg/cy/stories.go b/pkg/cy/stories.go index d5cf8c2b..cebcd3a6 100644 --- a/pkg/cy/stories.go +++ b/pkg/cy/stories.go @@ -149,4 +149,22 @@ func init() { stories.Wait(stories.ALot), }, }) + + stories.Register("cy/palette", initWithFrame, stories.Config{ + Input: []interface{}{ + stories.Wait(stories.Some), + stories.Type("ctrl+a", "ctrl+p"), + stories.Wait(stories.More), + stories.Type("choose"), + stories.Wait(stories.Some), + stories.Type("enter"), + stories.Wait(stories.Some), + stories.Type("down"), + stories.Wait(stories.Some), + stories.Type("down"), + stories.Wait(stories.Some), + stories.Type("enter"), + stories.Wait(stories.ALot), + }, + }) }