OrkoHunter / keep

A Meta CLI toolkit : Personal shell command keeper and snippets manager
MIT License
599 stars 54 forks source link

Compact output for keep run #77

Closed rahuliyer95 closed 3 years ago

rahuliyer95 commented 3 years ago

Compact output for keep run, should fix #39

❯ keep run

 1   ls -larth :: ls
 2   iptables -I INPUT -p ${protocol} -m ${protocol} --dport ${port} -j ACCEPT :: iptables open port

Select a command [1-2] (0 to cancel): 1
Execute
        $ ls -larth :: ls
? [Y/n]: Y
total 80
drwxr-xr-x   8 rahuli  staff   256B Feb 18 18:33 ..
-rw-r--r--   1 rahuli  staff   711B Feb 18 18:33 .gitignore
-rw-r--r--   1 rahuli  staff   168B Feb 18 18:33 .pep8speaks.yml
-rw-r--r--   1 rahuli  staff   1.0K Feb 18 18:33 LICENSE.md
-rw-r--r--   1 rahuli  staff    59B Feb 18 18:33 MANIFEST.in
drwxr-xr-x   4 rahuli  staff   128B Feb 18 18:33 completions
drwxr-xr-x   3 rahuli  staff    96B Feb 18 18:33 data
-rwxr-xr-x   1 rahuli  staff   152B Feb 18 18:33 release.sh
-rw-r--r--   1 rahuli  staff    47B Feb 18 18:33 requirements.txt
-rw-r--r--   1 rahuli  staff   3.8K Feb 18 18:33 README.md
-rw-r--r--   1 rahuli  staff   1.0K Feb 18 18:33 setup.py
-rw-r--r--   1 rahuli  staff   5.5K Feb 18 18:33 tutorial.md
drwxr-xr-x  16 rahuli  staff   512B Feb 18 18:38 .
drwxr-xr-x   3 rahuli  staff    96B Feb 18 18:38 .vscode
drwxr-xr-x  12 rahuli  staff   384B Feb 18 19:25 .git
drwxr-xr-x  10 rahuli  staff   320B Feb 18 19:25 keep

Also redirecting the output from the commands to stderr which enabling piping keep run commands

❯ keep run -n ls | awk '{print $9}'

 1   ls -larth :: ls

..
.gitignore
.pep8speaks.yml
LICENSE.md
MANIFEST.in
completions
data
release.sh
requirements.txt
README.md
setup.py
tutorial.md
.
.vscode
.git
keep
OrkoHunter commented 3 years ago

Thank you @rahuliyer95! ⭐