OrkoHunter / keep

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

Piping commands to keep new #90

Closed 0xrushi closed 1 year ago

0xrushi commented 1 year ago

Is it possible to pipe commands to keep new?

like

echo "sudo apt update" | keep new --description="sudo apt update"
rahuliyer95 commented 1 year ago

Yes, but you will have to provide 3 things - command, description, and alias.

❯ echo "command\ndesc\nalias" | keep new
Command: Description : Alias (optional) []: %

❯ keep list
+-----------+-------------+-------+
| Command   | Description | Alias |
+-----------+-------------+-------+
| $ command | desc        | alias |
+-----------+-------------+-------+

You can skip alias as follows,

❯ echo "command-no-alias\ndesc\n" | keep new

❯ keep list
+---------------+-------------+-------+
| Command       | Description | Alias |
+---------------+-------------+-------+
| $ command     | desc        | alias |
+---------------+-------------+-------+
| $ command-no- | desc        |       |
| alias         |             |       |
+---------------+-------------+-------+