6 ms·
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 w
by ronyeh 6y ago
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.
- berkes 6y agoWould tab completion be a startingpoint for this?
- ronyeh 6y agoYes, 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.
- berkes 6y agohence 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-and-zsh 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.
- petra 6y agoThis 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?
- lifthrasiir 6y agoThere 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 https://github.com/chriskiehl/Gooey
- least 6y agoWhile 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 https://tldr.sh
- ronyeh 6y agoI 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.
- silveri 6y agoThat'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
- deleted 6y ago[deleted]
- NotPavlovsDog 6y agowhen 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
- madog 6y agoI like cheat.sh. I have this in .bashrc to allow "cheat <cmd>" from bash shell: function cheat() { curl cht.sh/$1 }
- Badfood 6y agoThanks
- megous 6y agoThat'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.
- ronyeh 6y agoI 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....
- alexvoda 6y ago> 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.