Compare commits
2 Commits
fd6a42ccae
...
c5abd70e65
| Author | SHA1 | Date | |
|---|---|---|---|
| c5abd70e65 | |||
| 17bd886e3a |
37
README.md
37
README.md
@@ -47,4 +47,41 @@ This has some issues:
|
||||
Interestingly, I found the same trick they use to allow for menus to be printed but also pipe the output.
|
||||
By putting them menu on `stderr` instead of `stdout` you can have a menu that doesn't get yoinked by the pipe's reidrection.
|
||||
|
||||
# Recipies
|
||||
|
||||
> Note: I have the program wrapper script on my `$PATH` and have the wrapper script renamed to `opts`.
|
||||
|
||||
|
||||
Show all directories, entering the selected one.
|
||||
|
||||
```bash
|
||||
cd $(ls -la | grep dr | awk '{ print $9 }' | opts)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Show all partitions, mounting the selected one at `/mnt`.
|
||||
|
||||
```bash
|
||||
sudo mount $(lsblk -lno type,name | grep part | awk '{ print "/dev/" $2 }' | opts) /mnt
|
||||
```
|
||||
|
||||
You could even do the filtering after the fact, to give the user more info.
|
||||
```bash
|
||||
sudo mount $(lsblk | opts | awk '{ print $1 }') /mnt
|
||||
```
|
||||
(But this would allow you to select bad data.)
|
||||
|
||||
---
|
||||
|
||||
Choose what video codec to change all the videos in the current directory to.
|
||||
|
||||
```bash
|
||||
OPTS="mpeg4\nh265\nh264"
|
||||
SEL=$(printf $OPTS | opts)
|
||||
|
||||
for x in $(ls); do
|
||||
ffmpeg -i $x -v:c $SEL ${x}-enc.mp4
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
TMP=$(mktemp)
|
||||
|
||||
# Put the output to fd 4 and put the TUI to 2, since pipes redirect 1 by default
|
||||
cat /dev/stdin | ./target/release/select_option $TMP 1>&2
|
||||
cat /dev/stdin | select_option $TMP 1>&2
|
||||
|
||||
cat $TMP
|
||||
rm $TMP
|
||||
|
||||
Reference in New Issue
Block a user