Nukesor / pueue

:stars: Manage your shell commands.
MIT License
4.83k stars 130 forks source link

[Question] pueue command shortcuts #245

Closed sebdoesntknow closed 2 years ago

sebdoesntknow commented 2 years ago

First of all, thanks for pueue, it's an awesome tool and I been using it for a while now. I keep my tool set pretty lean and pueue is now part of it, appreciate it.

Secondly, I'm not asking the contributors to take care of this, I'm asking them (the author) if this would be something you'd like to see as part of pueue, I would be working on it myself.

Is your feature request related to a problem? Please describe.

Not a problem, just thought it'd be nice to have the ability to have shortcuts for commands and sub-commands, something like this:

from pueue add job to: pueue a job

from pueue status to: pueue s

from pueue remove to: pueue rm

Since I use pueue pretty often I have created an alias for it, p so it would be even less characters to be able to use it, i.e p s to get the queue status.

Describe the solution you'd like

I'd like to add a layer to handle the user input based on shortcuts and translate that to the full command, so the user would be able to use any of the pueue commands by typing less characters in the cli.

Describe alternatives you've considered

Additional context image

Nukesor commented 2 years ago

First of all, I'm happy to hear that Pueue has proven useful for you :)

It's kind of funny to see this issue, as I worked around this issue with a few aliases myself :D

alias p='pueue'
alias pad='pueue add --'
alias padh='pueue add -g hdd --'
alias padc='pueue add -g cpu --'
alias pst='pueue status'
alias pf='pueue follow'

Clap allows to easily add aliases: https://docs.rs/clap/3.0.0-beta.4/clap/struct.App.html#method.alias E.g. in our case it would be a simple

    #[clap(alias("rm"))]

the rm doesn't show up in the help text yet, but, to be honest, I kind of like that. I was kind of hesitant to to add aliases, as I feared that they would clutter the help texts and confuse people.

Though, I'm still hesitant to add aliases for everything. Adding aliases for everything would be a bad, as having to remember this many one- or two-character aliases would be quite a task. -> [a, cl, co, en, fo, ki, par, pau, rm, rt, rs, sta, sth, st, sw, wa]

We should add them for those commands that are inconvenient to type and most used.

remove -> rm is definitely one that should be added. add -> a I'm kind of torn at this one. add is quite fast to type. The only reason I added the alias pad was because of the -- at the very end. Adding single-character aliases feels kind of dirty. restart -> re? I definitely would appreciate that alias. follow -> fo/f? I guess it would be handy, but I don't necessarily need it

I'm voting against adding aliases for start, pause and kill. In my experience these shouldn't be done hastily. An extra quarter of a second typing gives people a little more time to overthink things :D.

sebdoesntknow commented 2 years ago

@Nukesor Thanks for getting back to me! That makes a lot of sense. I'll take a peek at the code and ping you again if I have questions. Have a good one!

Nukesor commented 2 years ago

Resolved with db98bcb