databricks / click

The "Command Line Interactive Controller for Kubernetes"
Apache License 2.0
1.49k stars 85 forks source link

Printing current set of target objects #204

Closed bazhenov closed 1 year ago

bazhenov commented 1 year ago

Quite frequently I keep addressing the same set of target objects. It would be useful to print them without entering query again.

For example I enter following command:

[my-context] [my-namespace] [none] > pods -r downloader
 ####   Name                                  Ready   Status    Restarts       Age
══════════════════════════════════════════════════════════════════════════════════════
    0   downloader-backend-69864b975f-klb97   0/0     Failed    Unknown/None   23d 2h
    1   downloader-backend-bf5cc5c89-pkbq4    2/2     Running              0   2d 23h
    2   downloader-cleanup-0                  1/1     Running              0   65d 8h
    3   downloader-frontend-74d647998-7s7bt   1/1     Running              0   72d 3h
    4   downloader-frontend-74d647998-w42q9   1/1     Running              0   72d 3h
──────────────────────────────────────────────────────────────────────────────────────

then I need select a pod (maybe multiple times) and perform different actions like check logs or perform some shell commands. And each time before switch I need to recall the list of current target objects to make a new selection. Right now I do it using several strategies depending on a context:

  1. reentering whole query again;
  2. using history search (Ctrl + R or Ctrl + P)

It would be useful to have some easy way to print current set of target objects without entering query command again (pods -r downloader in my case). Preferably this command should be very short (like . or even just maybe empty string?).

Maybe something like this already exists, but I can't figure it out. If this change is in line with your vision, I'm interested to provide a PR.

nicklan commented 1 year ago

I've had similar thoughts, so I'm open to a PR.

I'd suggest giving it a "normal" name like last or current or something along those lines. Then if you want a very short command for it you can just alias it.

nicklan commented 1 year ago

fixed by #205