News for hackers. Stuff that matters.
Re:You Don't Need a GUI by ronyeh on Friday April 09, 2021 @01:46AM (#26747099)
I like your point about discoverability.

What if there was such a thing as a right click menu for command line programs?

Like if I type ffmpeg or youtube-dl with no args, it lists the 3 most common ways to use it, and maybe allows an interactive CLI menu where you can build up the correct argument list by answering a few questions.

I would love the most useful commands to look like:

  ffmpeg --resizeVideoTo input.mp4 50% (0.5 also works of course)

  youtube-dl --do-the-thing-you-know-i-want-to-do <YOUTUBE_URL>

  cd --show-a-menu-of-the-last-10-paths-i-changed-to

  git --i-fd-up-my-last-commit-please-help

Most realistically, I'd want the invocation without arguments to show an interactive menu of the top 3 uses, so I could just select what I want to do.

Or if I provide a partial argument list, it should ask me to supply the rest of the args. Or maybe it should guess and do the right thing.

For example:

  ffmpeg input.mp4

  >> What would you like to do with input.mp4? 1) resize 2) rotate 3) crop 4) change video format

  youtube-dl URL
  
  >> Download the best video for URL to the current path? Press Enter to confirm. 

  cd

  >> Here are the last 5 paths you switched to. Choose 1...5.

  find

  >> Start typing a partial file name and we will show the top 10 matches from this path and its subdirectories. CTRL-<period> to turn on regular expression search.
Re:You Don't Need a GUI by silveri on Friday April 09, 2021 @02:59AM (#26747469)
That's basically what cheat.sh does. It's an editable wiki that contains common use cases (cheat sheets) and can be called directly from the command-line, e.g.:

    curl cheat.sh/ffmpeg
    curl cheat.sh/youtube-dl
    curl cheat.sh/cd
    curl cheat.sh/find
It gives quite a bit more than 3 use cases, but you could do:

    curl -s cheat.sh/ffmpeg | head
For more details you can go to the site in a browser or use:

    curl cheat.sh
    curl cheat.sh/:help
Re:You Don't Need a GUI by madog on Friday April 09, 2021 @09:46AM (#26750504)
I like cheat.sh. I have this in .bashrc to allow "cheat <cmd>" from bash shell:

    function cheat() {
        curl cht.sh/$1
    }
Re:You Don't Need a GUI by Badfood on Friday April 09, 2021 @03:45PM (#26755178)
Thanks
Re:You Don't Need a GUI by NotPavlovsDog on Friday April 09, 2021 @05:57AM (#26748578)
when calling cheat.sh for youtube-dl, it appears to cite tldr:youtube-dl

So perhaps a suggestion could be to install tldr so as to be able to call a summary in your terminal without the need for web-access to cheat.sh

Re:You Don't Need a GUI by megous on Friday April 09, 2021 @06:23AM (#26748713)
That's what aliases or shell functions are for. Put them into your .bashrc/.zshrc/.whatnotrc and you can have commands like that, without messing up the fine tools you mentioned for the rest of us. Just drop the first space.

ffmpeg--resize-video video.mp4 50%

.bashrc:

    ffmpeg--resize-video() {
       ffmpeg ... "$1"
    }
You'll have added benefit that ffmpeg--<TAB> will suggest you only your own UI, without interference from the tool's own options.
Re:You Don't Need a GUI by ronyeh on Friday April 09, 2021 @02:20PM (#26754033)
I make extensive use of aliases and bash functions. It's my only way to keep sane since I'm not smart enough to remember all these command line arguments....
Re:You Don't Need a GUI by least on Friday April 09, 2021 @02:24AM (#26747281)
While not entirely matching your vision for this, TLDR [1] does provide for a similar functionality (discoverability of functions of specific applications).

This doesn't help when you want to map the fuzzy idea of performing a specific action to a particular existing program but it has helped me avoid having to search online for how to perform a particular task with ffmpeg.

[1] https://tldr.sh

Re:You Don't Need a GUI by ronyeh on Friday April 09, 2021 @02:21PM (#26754047)
I was not aware of tldr. Thanks!

However I think the tldrs need to be sorted better. When tldr git, the first example was

  Check the Git version: git --version
Shouldn't the tldrs show me how to add, commit, push? Who knows.

I think the tldr lists should be interactive and allow you to select by pressing 1-9.

And maybe it should re-sort based on what you use most often, hehe.

Re:You Don't Need a GUI by least on Friday April 09, 2021 @10:41PM (#26758492)
Yeah, it would be neat if it made it a bit easier to work with. Git's TLDR page actually breaks it down through subcommands.

    tldr git commit
will show examples and explanations for using `git commit`.
Re:You Don't Need a GUI by Geezus_42 on Saturday April 10, 2021 @10:46AM (#26761859)
You can edit them, there just text files.
Re:You Don't Need a GUI by petra on Friday April 09, 2021 @01:59AM (#26747146)
This is a good path to go.

I like the 3 top uses.

As for questions, maybe when I write:

ffmpeg gui

I'll get a gui menu where I can select all the options, and that will generate a textual command for me that I could use further.

The hard part of course is creating GUI's for all the console apps.

Can that be done mechanically?

Re:You Don't Need a GUI by lifthrasiir on Friday April 09, 2021 @03:23AM (#26747595)
There is something like Gooey [1] that you can put to your own applications. I think it is technically possible to use Gooey to wrap existing applications, but not sure about the automation.

[1] https://github.com/chriskiehl/Gooey

Re:You Don't Need a GUI by alexvoda on Friday April 09, 2021 @09:00AM (#26749979)
> Or if I provide a partial argument list, it should ask me to supply the rest of the args. Or maybe it should guess and do the right thing.

PowerShell does this, but PowerShell is mostly despised by Linux users on forums.

Re:You Don't Need a GUI by berkes on Friday April 09, 2021 @01:52AM (#26747125)
Would tab completion be a startingpoint for this?
Re:You Don't Need a GUI by ronyeh on Friday April 09, 2021 @02:02AM (#26747161)
Yes, I love tab completion.

When I enabled tab completion for git and google cloud CLI, my life became much better.

However, I still think there needs to be a "right click menu" for command line programs. Someone needs to determine the 3 most common uses and make it so that --help lets me choose one of them by pressing 1, 2, or 3.

Right now, --help usually gives me something that is difficult for me to understand, especially if I have never used that command before.

Tab completion works great if I have used the command before and want to save time.

Re:You Don't Need a GUI by berkes on Friday April 09, 2021 @05:08AM (#26748305)
hence the "starting point".

Tab-completion could additionally list the "most common things given the context* I have".

Tab-completion needs not nessecarily be postfix. I've seen completion tooling** that would work somewhat like `invoice.pdf<tab> -> `open invoice.pdf\n cp invoice.pdf` etc.

And if `<tab>` conflicts, or breaks your mind because it must only work on postfix, it could be anything really, such as `<cmd>-r`.

Additionally, or underlying, a reasonable simple command like `whatcan` or `ctxt` (context) could work and be leveraged: `whatcan invoice.pdf` -> a list of common commands given the context* I have.

---

* Context I have would be your ~.\_history, the current directory-tree, permissions (why show `mv` if you don't have write access?), applications available, etc. pluggable maybe?

** e.g. the <ctrl>-r, interactive bash history search come to mind as pattern. But also tools like FZF https://github.com/junegunn/fzf#fuzzy-completion-for-bash-an... that don't nessecarily only "complete" on tab, but may replace larger parts of the commandline.*

Edit: formatting.