nushell/crates/nu-command/src
David Laban 8501024546
signpost 'input list --types [key]' from 'keybindings list' (#10287)
Supercedes https://github.com/nushell/nushell/pull/10196

# Description

After reading
https://github.com/nushell/nushell/pull/10196#issuecomment-1703986359 I
added a signpost from `keybindings listen` to `input listen`

When I initially tried `input listen` it always immediately returned
with:
```
╭───────┬────────╮
│ type  │ focus  │
│ event │ gained │
╰───────┴────────╯
```

I added an example to `input listen --help` to suggest only listening to
key events

Initially I also included a `result` but it prints as:

```
  ╭───────────┬───────────────╮
  │ type      │ key           │
  │ key_type  │ char          │
  │ code      │ c             │
  │ modifiers │ [list 1 item] │
  ╰───────────┴───────────────╯
```

rather than:

```
╭───────────┬───────────────────────────────╮
│ type      │ key                           │
│ key_type  │ char                          │
│ code      │ c                             │
│           │ ╭───┬───────────────────────╮ │
│ modifiers │ │ 0 │ keymodifiers(control) │ │
│           │ ╰───┴───────────────────────╯ │
╰───────────┴───────────────────────────────╯
```
so I removed it.

# User-Facing Changes

<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

* Example describing how to use `input list --types [key]` to listen for
keybindings.
* Signpost pointing at `use std input; input list --types [key]` from
`keybindings list`.

## After merging

It is probably worth:

a) signposting to the keybindings section of the book from both of these
subcommands (like I did in
https://github.com/nushell/nushell/pull/10193),
b) giving an example in the book of how to take the output from `input
listen --types [key]` and format it for including in `config nu`
c) there are not currently any examples in
crates/nu-utils/src/sample_config/default_config.nu for keybindings with
multiple modifiers. Should I add alt+backspace-in-macos-vscode as an
example (gets translated to `{ modifier: control_alt keycode: char_h }`
for historical reasons)?

---------

Co-authored-by: Antoine Stevan <44101798+amtoine@users.noreply.github.com>
2023-09-09 09:42:37 -05:00
..
bytes Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
charting Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
conversions Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
database Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
date Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
debug Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
env Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
experimental Add functions for each Value case (#9736) 2023-07-21 08:20:33 -05:00
filesystem use uutils/coreutils cp command in place of nushell's cp command (#10097) 2023-09-08 13:57:38 -05:00
filters feat: Search terms for use, while, and range (#5093) (#10265) 2023-09-07 22:11:42 +02:00
formats rename the types with spaces in them to use - (#9929) 2023-09-06 13:22:12 -05:00
generators Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
hash Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
help Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
math Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
misc REFACTOR: move source out of deprecated commands (#9060) 2023-05-04 00:02:03 +02:00
network Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
path Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
platform signpost 'input list --types [key]' from 'keybindings list' (#10287) 2023-09-09 09:42:37 -05:00
random Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00
removed Rename misused "deprecation" to removal (#10000) 2023-08-15 07:17:31 +12:00
shells Fix usage for the exit command. (#9450) 2023-06-16 10:09:02 +02:00
strings update format date when using %x %X %r (#10272) 2023-09-08 08:59:05 -05:00
system add more ps columns in Windows (#10275) 2023-09-08 12:24:29 -05:00
viewers add 6 more table themes (#10279) 2023-09-08 16:34:36 -05:00
default_context.rs use uutils/coreutils cp command in place of nushell's cp command (#10097) 2023-09-08 13:57:38 -05:00
example_test.rs enable/update some example tests so they work again (#10058) 2023-08-19 09:06:59 -05:00
lib.rs Move eval_hook to nu-cmd-base (#10146) 2023-08-29 23:46:50 +02:00
progress_bar.rs cp progress bar implementation (#8012) 2023-02-22 11:57:38 -08:00
sort_utils.rs Move Value to helpers, separate span call (#10121) 2023-09-03 07:27:29 -07:00