Several new scripts added

This commit is contained in:
Alexander Gehrke 2020-07-29 14:58:50 +02:00
parent 1809ffacb3
commit cdbcc9692a
5 changed files with 82 additions and 0 deletions

21
misc/docopen Executable file
View file

@ -0,0 +1,21 @@
#!/bin/zsh
zparseopts -D -E h=help -help=help e+:=extension -extension+:=extension
if [[ -n "$help" ]]; then
echo "Usage: docopen [DIR [EXTENSION ...]]"
echo
echo "Searches for files in given or current dir, optionally filtered by extension"
echo "Files are shown in dmenu and selected file is opened"
exit 1
fi
# return all files in the current dir
# if arguments are given, each argument is taken as a file extension. only files
# which match any given extension are returned
search-docs() {
fd --type file $extension . "$@"
}
target=$(search-docs "$@" | txmenu -i -l 50 -p 'Open Document:')
[[ -n $target ]] && xdg-open $target