feature t script
This commit is contained in:
parent
e98e06cc87
commit
10c7e768a5
@ -15,6 +15,7 @@ __pycache__/
|
||||
*.spec
|
||||
|
||||
.env
|
||||
*.env
|
||||
*.log
|
||||
*.bak
|
||||
*~
|
||||
|
||||
@ -39,7 +39,7 @@ bind-key Y {
|
||||
display-popup -E -w 90% -h 80% "nvim /tmp/tmux-buffer"
|
||||
}
|
||||
|
||||
bind t display-popup -E -h 70% -w 60%
|
||||
bind t display-popup -E -h 70% -w 60% -d "${HOME}"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ GREP_OPTIONS=(
|
||||
)
|
||||
|
||||
alias grep='grep $GREP_OPTIONS'
|
||||
alias g='grep --dereference-recursive'
|
||||
alias g='grep --dereference-recursive --line-number'
|
||||
|
||||
alias _='sudo'
|
||||
alias root='sudo --login TMOUT=450'
|
||||
|
||||
@ -5,10 +5,40 @@ set -o errexit
|
||||
set -o nounset
|
||||
|
||||
|
||||
readonly ENV_FILE=".t.env"
|
||||
readonly EXIT_SUCCESS=0
|
||||
|
||||
readonly NOTES_DIR_BASE="${HOME}/.t"
|
||||
readonly NOTES_DIR="${NOTES_DIR_BASE}/${t:-default}"
|
||||
readonly DEFAULT_NAMESPACE="def"
|
||||
|
||||
|
||||
find_file_up_fs() (
|
||||
file_to_find="${1}"
|
||||
|
||||
while [ ! "$(pwd)" = "/" ]
|
||||
do
|
||||
if [ -f "${file_to_find}" ]; then
|
||||
realpath "${file_to_find}"
|
||||
break
|
||||
fi
|
||||
cd ..
|
||||
done
|
||||
)
|
||||
|
||||
load_env_if_found() {
|
||||
env_file="$(find_file_up_fs "./${ENV_FILE}")"
|
||||
|
||||
if [ -n "${env_file}" ]; then
|
||||
. "${env_file}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -z "${t+x}" ]; then
|
||||
load_env_if_found
|
||||
fi
|
||||
|
||||
|
||||
readonly t="${t:-${DEFAULT_NAMESPACE}}"
|
||||
readonly NOTES_DIR="${NOTES_DIR_BASE}/${t}"
|
||||
|
||||
TAB="$(printf -- '\t')"
|
||||
readonly TAB
|
||||
@ -58,6 +88,11 @@ get_notes_with_indexes() {
|
||||
SAVEIFS="${IFS}"
|
||||
IFS=';'
|
||||
|
||||
|
||||
if ${_TO_SHOW:-false}; then
|
||||
printf -- '\033[1m# %s\033[0m\n\n' "${t}"
|
||||
fi
|
||||
|
||||
index=1
|
||||
for note in $(IFS="${IFS}" get_notes_sorted_by_access_time)
|
||||
do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user