plugin/base: rewrite `t()` function to use `todo.sh`
Move the test for whether `plugin/todo` is enabled inside the function, and remove the alias from there. Alsö, respect `$XDG_STATE_HOME` and move the old `~/.t` file if it exists.pull/2005/head
parent
02b57a83ef
commit
d6bcedfa96
|
|
@ -67,7 +67,7 @@ function passgen() {
|
||||||
|
|
||||||
# Create alias pass to passgen when pass isn't installed or
|
# Create alias pass to passgen when pass isn't installed or
|
||||||
# BASH_IT_LEGACY_PASS is true.
|
# BASH_IT_LEGACY_PASS is true.
|
||||||
if ! _command_exists pass || [[ "${BASH_IT_LEGACY_PASS:-}" = true ]]; then
|
if ! _command_exists pass || [[ "${BASH_IT_LEGACY_PASS:-}" == true ]]; then
|
||||||
alias pass=passgen
|
alias pass=passgen
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -120,19 +120,26 @@ function usage() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! _bash-it-component-item-is-enabled plugin todo; then
|
|
||||||
# if user has installed todo plugin, skip this...
|
|
||||||
function t() {
|
function t() {
|
||||||
about 'one thing todo'
|
about 'todo.sh if available, otherwise one thing todo'
|
||||||
param 'if not set, display todo item'
|
param 'if not set, display todo item'
|
||||||
param '1: todo text'
|
param '1: todo text'
|
||||||
if [[ "$*" == "" ]]; then
|
|
||||||
cat ~/.t
|
local todotxt="${XDG_STATE_HOME:-~/.local/state}/bash_it/todo.txt"
|
||||||
|
|
||||||
|
if _bash-it-component-item-is-enabled plugin todo; then
|
||||||
|
todo.sh "$@"
|
||||||
|
return
|
||||||
|
elif [[ ! -f "${todotxt}" && -f ~/.t ]]; then
|
||||||
|
mv -vn ~/.t "${todotxt}" # Verbose, so the user knows. Don't overwrite, just in case.
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$#" -eq 0 ]]; then
|
||||||
|
cat "${todotxt}"
|
||||||
else
|
else
|
||||||
echo "$*" > ~/.t
|
echo "$@" >| "${todotxt}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
fi
|
|
||||||
|
|
||||||
if _command_exists mkisofs; then
|
if _command_exists mkisofs; then
|
||||||
function mkiso() {
|
function mkiso() {
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,3 @@ about-plugin 'Todo.txt integration'
|
||||||
# you may override any of the exported variables below in your .bash_profile
|
# you may override any of the exported variables below in your .bash_profile
|
||||||
: "${TODOTXT_DEFAULT_ACTION:=ls}"
|
: "${TODOTXT_DEFAULT_ACTION:=ls}"
|
||||||
export TODOTXT_DEFAULT_ACTION
|
export TODOTXT_DEFAULT_ACTION
|
||||||
|
|
||||||
alias t='todo.sh'
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue