amonks / run

Go run some tasks!
https://amonks.github.io/run/
Other
19 stars 4 forks source link

if you don't specify a task, should you get a task browser ui? #57

Open amonks opened 1 year ago

amonks commented 1 year ago

if so, what should the task browser look like? should it list the commands and stuff or just task names? if commands, what happens for non script-task implementations of Task? should Task have a Description()string method?

also, what happens if not-a-tty? it feels wrong for tty-ness to change the behavior a lot

ecshreve commented 1 year ago

description field could be nice for -list output.

could be cool to have a "preview" window (a la fzf file search) that pops up the whole highlighted task

amonks commented 1 year ago

good point

I'm gonna split out Description into its own issue, since that seems like a quick unambiguous win whether or not there's an fzf thing

ecshreve commented 7 months ago

I think a task browser of some sort could be valuable.

This is a somewhat common anti-workflow I get into

A useful thing for me in this situation would a way to "preview" or "quick look" task definitions from the terminal.


Some ideas that came to mind:

(things that involve changing run)

(things that rely on outside tools, end user configuration)

Curious if you've thought about this recently. Or if there's other tools or things y'all use with run that might make something like this easy / easier 😂

amonks commented 7 months ago

@ecshreve

I can definitely relate to that anti-workflow: that's me every time I come back to a project.

re: ideas,

  1. Tabular output for -list is interesting. Unlike many CLIs that output tables, I think we'd need multiple lines of content in some cells, but that appears to be well supported by lipgloss's table renderer. I wonder whether it'd end up being prohibitively wide.

  2. Machine-readable output would be very useful also. We don't currently have a good integration story except for with Go programs, and this could be a good fallback for integrators in other languages. Plus for scripting.

  3. Personally I think an interactive browser might be the most usable option, since we could fit just-the-IDs of many tasks onto the screen, but still afford for showing details about them, just one-at-a-time. On large projects (30+ tasks) I think even a table could easily end up being too much -list output to fit on a screen, so your tasks still aren't "glanceable". I suppose this is an information design problem, so there might be a good solution, but I can't immediately picture it. Particularly since (as you note) it's often useful to see the whole cmd, which might be many lines per task.

As a bonus, if we had an interactive browser, it would take some pressure off of -list to be human-readable, and we could implement a nice parseable -list without giving up usability.

Off the dome, here are some thoughts about what a good version of that might look like:

cgsdev0 commented 7 months ago

here's a little wrapper that implements a browser with fzf if you just do run with no args

i have this in my .zshrc but it should work in a .bashrc too

if which run &> /dev/null && which fzf &> /dev/null; then
  run() {
    if [[ $# -eq 0 ]]; then
      local TASK="$(command run -list \
        | grep '^  [^ ]' \
        | tr -d ' ' \
        | fzf -0 --ansi)"
      command run "$TASK"
    else
      command run "$@"
    fi
  }
fi
amonks commented 7 months ago

Related: once we have a UI for browsing tasks and inspecting their dependencies and configuration, we could also offer it in regular task-running mode. "hit i to show task info" kind of thing. I'll make another ticket and link it here.

amonks commented 7 months ago

128