terminal-command-manager

command module
v0.0.0-...-fffcb7f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 15 Imported by: 0

README

Terminal command bookmark manager

Save your terminal commands in one place. Then find command through searchable dropdown. Written in go, primarily for LInux.

Default program view

Dependencies

Verify you have go installed golang

go version

Get dependencies (github.com/rivo/tview)

go get github.com/rivo/tview

Building:

./build.sh

Will build cli executable in current directory

Creating bookmarks

  • Bookmarks are simply terminal commands.
  • Add them in commands.sh file (They will be hardcoded in executable at compile time)
  • Words in comment line before command (in commands.sh) become search keywords in executable:
#linux list directories
ls

becomes:

linux list directories^ls
  • Bookmarks support user input with default values. Bookmark such as du -hs <prompt:enter directory:.> will ask for input string which will replace "prompt" tag. If user enters no characters default value (in parentheses) will be used.

Example with . as default value:

$ ./cli
prepare comm: du -hs <prompt:enter directory:.>
enter directory (.): /tmp
executing: du -hs /tmp

54M     /tmp

Using program

Standard way:
./cli
Shortcut way
./cli ls

will execute first bookmark it finds with passed argument as a console command ls linux filesystem list files permissions^ls -lpah --color | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2:

ls -lpah --color | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2
Make it accessible from any directory by copying to your favourite bin directory
ln -s /currentdir/cli /usr/bin/yournewcli

Syntax

CLI Arguments

print print next script without running it
-v print version

Script directives
Prompt
<prompt:info text[:default value]>

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳