Skip to content

Instantly share code, notes, and snippets.

@astrsk-hori
Last active July 6, 2018 01:17
Show Gist options
  • Save astrsk-hori/6d034a36851569a40b54118ccb9bf9a9 to your computer and use it in GitHub Desktop.
Save astrsk-hori/6d034a36851569a40b54118ccb9bf9a9 to your computer and use it in GitHub Desktop.
todo (use peco)
alias tcl="cat ~/.todo_history|nl"
alias tl="cat ~/.todo|nl"
alias te="vim ~/.todo"
alias td="remove-todo"
function remove-todo() {
TARGET=$(tl|peco)
NUM=$(echo $TARGET|cut -f1|tr -d ' ')
cat ~/.todo|sed -e "${NUM}d" >~/.todo_tmp
rm ~/.todo
mv ~/.todo_tmp ~/.todo
BK=$(echo $TARGET|cut -f2)
COMPDATE=$(date '+%F %T')
echo "${COMPDATE} ${BK}" >> ~/.todo_history
echo $TARGET
echo "上記TODOを削除しました。"
tl
}
alias ta="add-todo"
function add-todo() {
if [ "$*" = "" ];then
echo "Please Input todo!"
else
echo "$*" >> ~/.todo
tl
fi
}
function remove-todo-by-no() {
NUM=$1
if [ "$NUM" = "" ];then
echo "Please Input todo Number!"
else
cat ~/.todo|sed -e "${NUM}d" >~/.todo_tmp
rm ~/.todo
mv ~/.todo_tmp ~/.todo
fi
}
@astrsk-hori
Copy link
Author

astrsk-hori commented Jun 27, 2018

terminal で使う簡易TODO

  • tl todoのリスト表示
  • ta todoの追加
  • te todoの修正
  • td todoの完了(削除)
  • tcl 完了したtodoの一覧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment