Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clean_files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ plugins/available/pyenv.plugin.bash
plugins/available/rbenv.plugin.bash
plugins/available/ruby.plugin.bash
plugins/available/textmate.plugin.bash
plugins/available/todo.plugin.bash
plugins/available/xterm.plugin.bash
plugins/available/zoxide.plugin.bash

Expand Down
36 changes: 21 additions & 15 deletions plugins/available/base.plugin.bash
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function passgen() {

# Create alias pass to passgen when pass isn't installed or
# 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
fi

Expand Down Expand Up @@ -120,20 +120,26 @@ function usage() {
esac
}

# shellcheck disable=SC2144 # the glob matches only one file
if [[ ! -e "${BASH_IT?}/plugins/enabled/todo.plugin.bash" && ! -e "${BASH_IT?}/plugins/enabled"/*"${BASH_IT_LOAD_PRIORITY_SEPARATOR-}todo.plugin.bash" ]]; then
# if user has installed todo plugin, skip this...
function t() {
about 'one thing todo'
param 'if not set, display todo item'
param '1: todo text'
if [[ "$*" == "" ]]; then
cat ~/.t
else
echo "$*" > ~/.t
fi
}
fi
function t() {
about 'todo.sh if available, otherwise one thing todo'
param 'if not set, display todo item'
param '1: todo text'

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
echo "$@" >| "${todotxt}"
fi
}

if _command_exists mkisofs; then
function mkiso() {
Expand Down
12 changes: 3 additions & 9 deletions plugins/available/todo.plugin.bash
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/bin/bash
cite about-plugin
# shellcheck shell=bash
about-plugin 'Todo.txt integration'

# you may override any of the exported variables below in your .bash_profile

if [ -z "$TODOTXT_DEFAULT_ACTION" ]; then
# typing 't' by itself will list current todos
export TODOTXT_DEFAULT_ACTION=ls
fi

alias t='todo.sh'
: "${TODOTXT_DEFAULT_ACTION:=ls}"
export TODOTXT_DEFAULT_ACTION