Re:Simple command-line snippet manager, written in Go
by msluyter on Monday March 13, 2017 @10:44AM
(#13858183)
This is cool. Also, there is one little trick you can do to make your shell history easier to search. You can comment your commands and then search via comments:
% big hairy command here # foo the bars!
Then you can history search for 'foo' or whatnot. That doesn't totally obviate the need for a tool like this. I plan on checking it out.
Re:Simple command-line snippet manager, written in Go
by jfultz on Monday March 13, 2017 @01:36PM
(#13860174)
Not too interested in the snippet manager, but when I was watching the demo movie, I noticed the author doing inline shell variable expansion. It never even occurred to me that shells could do that. Wish I had known about this years ago.
Re:Simple command-line snippet manager, written in Go
by libria on Monday March 13, 2017 @01:12PM
(#13859873)
The day we know a language has made it is the day people no longer feel the need to suffix "written in X" to attract clicks.
This applies to Go, Rust, whatever. I'd love to see future projects stand on their own merits and be pleasantly surprised when discovering the source language on my own.
Re:Simple command-line snippet manager, written in Go
by icedcoffee99 on Monday March 13, 2017 @02:01PM
(#13860507)
It can make a difference. For example, if this was written in ruby I might not bother using. On every device I'd have to get the correct ruby environment setup, install any dependent gems, and make sure if I have the gem path set correctly.
If it's written in go I know I can drop a static binary in my PATH and be done.
Re:Simple command-line snippet manager, written in Go
by kovek on Monday March 13, 2017 @03:58PM
(#13861764)
That's cool! I was thinking of doing something similar a few weeks ago. I settled on using tools I knew well to just achieve what I needed quickly. I use tmux and emacs. I run a tmux session with a window which has a top and bottom pane. Top pane shows a shell, and bottom pane shows emacs. Thanks to tmux, I can send keystrokes to a different pane. With emacs, I tell tmux to send the current line of characters to the top pane. In the emacs session, I have open a help.org file, where I organize some commands. For some reason, this worked with tmux 2.1 but not with tmux 2.3:
Re:Simple command-line snippet manager, written in Go
by amelius on Monday March 13, 2017 @12:05PM
(#13859006)
> [...] it is difficult to search them from shell history. There are many similar commands, but they are all different.
I think there's a much simpler way to go about this. Just add a snippet by typing it in your shell followed by an echo command, e.g.:
ls -rt; echo "List all files reverse-sorted by date"
Then the problem remains to search your shell history, but there are many solutions for that already. And the good part is (besides not needing another tool) that you can search the same way for commands that were not labeled with a description.
Re:Simple command-line snippet manager, written in Go
by friendly_chap on Monday March 13, 2017 @12:03PM
(#13858991)
If you feel like working on something like that, see my comment in this thread about Borg. We are pretty far ahead in the development, and happy to get contributors.
We have 4 members in the team but there are loads of work to do.
There is also a web interface https://ok-b.org/
Anyone can edit the public snippets (only bash for now, because it is such an obvious usecase), but private ones are coming too.
The plan is provide a way to save and search snippets from anywhere, terminal, web, phone, whatever.
It is also written in Go.
Edit: the mobile version of the site is not too responsive, but a new version of the UI is coming :)
*Edit 2: You can also self host the server/frontend yourself and change your terminal client to point to your own.
But so far I've been unable to get it working in any way- I've submitted a github issue.
Speaking of github- any chance we can have other login mechanisms for the frontend? I do so loathe having external dependencies.
And yeah, there is an issue on some systems with dependencies of a go package. We are going to fix that, sorry.
Thanks for the issue.
On bash, it's M-C-e where the Escape key can serve as the "M" portion. Also, M-r to clear the command-line, which I could also have used many times. Bash docs: https://www.gnu.org/software/bash/manual/html_node/Miscellan...
This applies to Go, Rust, whatever. I'd love to see future projects stand on their own merits and be pleasantly surprised when discovering the source language on my own.
If it's written in go I know I can drop a static binary in my PATH and be done.
I think there's a much simpler way to go about this. Just add a snippet by typing it in your shell followed by an echo command, e.g.:
Then the problem remains to search your shell history, but there are many solutions for that already. And the good part is (besides not needing another tool) that you can search the same way for commands that were not labeled with a description.We have 4 members in the team but there are loads of work to do.
I have long held a ~/bin directory that contains things that are similar.