Add '.sh' to library modules'
This commit is contained in:
parent
482ef42403
commit
a6e3e68206
8
misc/fzf
8
misc/fzf
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
## FZF helpers
|
||||
|
||||
FZF_OPTS=(--read0 --select-1 --exit-0 --print0)
|
||||
|
||||
run_fzf() {
|
||||
fzf "${FZF_OPTS[@]}" -- "$@"
|
||||
}
|
7
misc/fzf.sh
Normal file
7
misc/fzf.sh
Normal file
@ -0,0 +1,7 @@
|
||||
## FZF helpers
|
||||
|
||||
FZF_OPTS=('--select-1' '--exit-0')
|
||||
|
||||
run_fzf() {
|
||||
fzf "${FZF_OPTS[@]}" -- <<< "$@" || return 2
|
||||
}
|
34
misc/search
34
misc/search
@ -1,34 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Utility functions and helpers for searching
|
||||
DEFAULT_FD_OPTS=(--hidden --print0 --type f --type l --threads $(nproc))
|
||||
|
||||
# Locate options
|
||||
declare -a LOCATE_OPTS
|
||||
|
||||
# Platform-specific options
|
||||
# macOS doesn't support GNU-style long options
|
||||
if [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||
LOCATE_OPTS=(--all --ignore-case --null)
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
LOCATE_OPTS=(-0 -i)
|
||||
fi
|
||||
|
||||
# Parameters:
|
||||
# $1: directory
|
||||
# $2-n: extra arguments
|
||||
find_files() {
|
||||
local directory="$1"
|
||||
shift
|
||||
fd "${DEFAULT_FD_OPTS[@]}" "$@" -- . "$directory"
|
||||
}
|
||||
|
||||
|
||||
# Parameters:
|
||||
# $1: pattern
|
||||
# $2-n: extra arguments
|
||||
locate_files() {
|
||||
local pattern="$1"
|
||||
shift
|
||||
locate "${LOCATE_OPTS[@]}" "$@" -- . "$pattern"
|
||||
}
|
15
misc/search.sh
Normal file
15
misc/search.sh
Normal file
@ -0,0 +1,15 @@
|
||||
# Utility functions and helpers for searching
|
||||
DEFAULT_FD_OPTS=('--hidden' '--type' 'f' '--type' 'l' '--threads' "$(nproc)")
|
||||
|
||||
# Parameters:
|
||||
# $1: directory
|
||||
# $2-n: extra arguments
|
||||
find_files() {
|
||||
if [[ -d "$1" ]]; then
|
||||
local directory="$1"
|
||||
shift
|
||||
fd "${DEFAULT_FD_OPTS[@]}" "$@" -- . "$directory"
|
||||
else
|
||||
fd "${DEFAULT_FD_OPTS[@]}" "$@"
|
||||
fi
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user