1
1
Fork
You've already forked quickactions
0
No description
  • Python 75.6%
  • Shell 24.4%
Find a file
2024年02月24日 23:37:16 +01:00
src init: dump 2024年02月24日 23:37:16 +01:00
readme.md init: dump 2024年02月24日 23:37:16 +01:00

quickactions

This repository is a dump of scripts around dmenu/fzf that might be useful for many people.

Unfortunately the only documentation right now is the code itself.

  1. menu:
    1. A simple utility wrapper over dmenu and fzf. It invokes fzf if a tty is available, or dmenu otherwise.
    2. Allows menu based scripts to be used from both inside/outside a terminal.
  2. quickactions:
    1. This script acts as an interactive "open with" menu.
    2. It reads input from either argv or stdin - this is the input that you wish to "open".
    3. It then presents a menu that lets you enter a shell command to run on the input - this is the command that you wish to "open with".
    4. "Open with" entries are saved in a cache file - this sort of works like shell history. Menu entries are ordered by usage frequency.
    5. The command you enter can pass its output back to the menu, so you can chain commands interactively.
  3. json_menu:
    1. This script reads json data from stdin, and presents a menu containing the passed data. Selected data is printed to stdout.
    2. How the data is read and presented can be customized quickly with arguments passed. Example:
    $ echo '{"products":[{"id":1,"brand":"Lorem","title":"Ipsum..."}]}' | json_menu choices=it.products formatter='f"#{it.id} #{it.brand} - #{it.title}"' value=it.id
    
    1. It's a Python script, and the expressions passed as arguments are evaluated as Python expressions.
  4. lines:
    1. This script reads line data from stdin, and filter/map commands as Python expressions from argv. Example:
    $ find . | lines filter 'len(it) == 13' map 'f"{it} is {os.stat(it).st_size} bytes"'
    

Author

Awal Garg <awalgarg.me>

License: GPLv3