├── LICENSE ├── README.md └── tusker /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Deep Bhattacharyya 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Built with love](http://forthebadge.com/images/badges/built-with-love.svg) 2 | # Tusker 3 | A dead simple todo manager in about *a hundred lines* of code. 4 | For those who live in the terminal. 5 | 6 | ### Installation 7 | Just download the executable from [releases](https://github.com/coderick14/tusker/releases) and put it in your `$PATH`. Period. 8 | Type `tusker help` to get started. 9 | 10 | ### Usage 11 | - Add a task 12 | ``` 13 | tusker add "The task that I would've forgotten" 14 | ``` 15 | - Show current tasks *[ID, Status, Description, UpdatedAt]* 16 | ``` 17 | tusker show 18 | 1 ❌ Collect laundry 25 April 2018 11:53:21 19 | 2 ❌ Collect NOC certificate 25 April 2018 11:53:23 20 | 3 ❌ Fill rems 25 April 2018 11:53:25 21 | ``` 22 | - Mark one or more tasks as done 23 | ``` 24 | tusker check 1 3 25 | tusker show 26 | 1 ✓ Collect laundry 25 April 2018 11:53:21 27 | 2 ❌ Collect NOC certificate 25 April 2018 11:53:23 28 | 3 ✓ Fill rems 25 April 2018 11:53:25 29 | ``` 30 | - Mark one or more tasks as undone 31 | ``` 32 | tusker uncheck 1 3 33 | tusker show 34 | 1 ❌ Collect laundry 25 April 2018 11:53:21 35 | 2 ❌ Collect NOC certificate 25 April 2018 11:53:23 36 | 3 ❌ Fill rems 25 April 2018 11:53:25 37 | ``` 38 | - Edit the description for an existing task 39 | ``` 40 | tusker edit 3 Fill rems and forms 41 | tusker show 42 | 1 ❌ Collect laundry 25 April 2018 11:53:21 43 | 2 ❌ Collect NOC certificate 25 April 2018 11:53:23 44 | 3 ❌ Fill rems and forms 25 April 2018 11:53:25 45 | ``` 46 | - Delete one or more tasks from the list 47 | ``` 48 | tusker del 1 3 49 | tusker show 50 | 1 ❌ Collect NOC certificate 25 April 2018 11:53:23 51 | ``` 52 | ### What's the difference between `check` and `del`? 53 | Use `del` if you'd *never* like to look back at a completed task. 54 | Use `check` if you want the satisfaction of seeing the ✓ beside your completed task for a while. 55 | Also, you can `uncheck` it anytime, in case you missed out on something :( 56 | 57 | ### Tip 58 | Add `tusker show` at the end of your `.bashrc`, `.zshrc` or `config.fish` to get reminded about your pending tasks whenever you fire up a terminal. 59 | 60 | ### Why tusker? 61 | - No dependencies. Seriously. 62 | - Simple. So that you can focus on what's important, which is **finishing your tasks**. 63 | 64 | ### Features and contributions 65 | `tusker` was written a couple of nights before my semester examination because I kept forgetting the topics that I had skipped. So if you find a bug or you'd like to add a feature, feel free to raise an issue or send a pull request!! 66 | 67 | ### Note 68 | I've tried to make the script *POSIX compatible*. However, if you do face an issue regarding that, please raise an issue. Or send a PR *(even better)*!! 69 | -------------------------------------------------------------------------------- /tusker: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Author : Deep Bhattacharyya (https://github.com/coderick14) 4 | 5 | HELP_MSG=" 6 | _ _ 7 | | |_ _ _ ___| | _____ _ __ 8 | | __| | | / __| |/ / _ \ '__| 9 | | |_| |_| \__ \ < __/ | 10 | \__|\__,_|___/_|\_\___|_| 11 | 12 | A dead simple todo manager 13 | 14 | Add a new task : tusker add TASK_DESCRIPTION 15 | Mark a task as done : tusker check TASK_ID 16 | Mark a task as undone : tusker uncheck TASK_ID 17 | Delete a task : tusker del TASK_ID 18 | Edit task description : tusker edit TASK_ID NEW_TASK_DESCRIPTION 19 | Show existing tasks : tusker show 20 | " 21 | 22 | FILE_DIR="$HOME/.cache/tusker" 23 | FILE_NAME="$FILE_DIR/tasks.txt" 24 | TICK='✓ ' 25 | CROSS='❌ ' 26 | DELIM='$$$' 27 | 28 | check_args() { 29 | if [ $# -eq 1 ] && ([ "$1" = "show" ] || [ "$1" = "help" ]); then 30 | return 31 | fi 32 | 33 | if [ $# -gt 1 ]; then 34 | return 35 | else 36 | printf "Not a valid command. Type 'tusker help' for usage.\n" 37 | exit 38 | fi 39 | } 40 | 41 | create_file() { 42 | mkdir -p "$FILE_DIR" 43 | if [ ! -e "$FILE_NAME" ]; then 44 | touch "$FILE_NAME" 45 | fi 46 | } 47 | 48 | add_task() { 49 | task_desc="$1" 50 | current_timestamp=$(date +"%d %B %Y %H:%M:%S") 51 | task_string="$CROSS $DELIM $task_desc $DELIM $current_timestamp" 52 | 53 | printf "%b\n" "$task_string" >> "$FILE_NAME" 54 | } 55 | 56 | delete_task() { 57 | format_str="" 58 | for task_id in "$@" 59 | do 60 | format_str="$task_id""d;""$format_str" 61 | done 62 | sed -i -e "$format_str" "$FILE_NAME" 63 | } 64 | 65 | check_task() { 66 | for task_id in "$@" 67 | do 68 | sed -i "$task_id s/^./$TICK/" "$FILE_NAME" 69 | done 70 | } 71 | 72 | uncheck_task() { 73 | for task_id in "$@" 74 | do 75 | sed -i "$task_id s/^./$CROSS/" "$FILE_NAME" 76 | done 77 | } 78 | 79 | edit_task() { 80 | task_id="$1" 81 | shift 82 | task_desc="$*" 83 | current_timestamp=$(date +"%d %B %Y %H:%M:%S") 84 | task_string="$CROSS $DELIM $task_desc $DELIM $current_timestamp" 85 | sed -i "$task_id s/.*/$task_string/" "$FILE_NAME" 86 | } 87 | 88 | show_tasks() { 89 | line_count=$(wc -l $FILE_NAME | awk '{print $1}') 90 | 91 | if [ $line_count -eq 0 ]; then 92 | printf "You're all caught up!!\n" 93 | return 94 | fi 95 | 96 | nl "$FILE_NAME" | column -t -s $DELIM 97 | } 98 | 99 | 100 | main() { 101 | check_args "$@" 102 | create_file 103 | 104 | action=$1 105 | 106 | case $action in 107 | add) 108 | shift 109 | add_task "$*" 110 | printf "Task added\n" 111 | 112 | ;; 113 | del) 114 | shift 115 | delete_task "$@" 116 | printf "Task(s) deleted\n" 117 | ;; 118 | 119 | check) 120 | shift 121 | check_task "$@" 122 | printf "Task(s) marked as done\n" 123 | ;; 124 | 125 | uncheck) 126 | shift 127 | uncheck_task "$@" 128 | printf "Task(s) marked as undone\n" 129 | ;; 130 | 131 | edit) 132 | shift 133 | edit_task "$@" 134 | printf "Task edited\n" 135 | ;; 136 | 137 | show) 138 | show_tasks 139 | ;; 140 | 141 | help) 142 | printf "%s" "$HELP_MSG" 143 | ;; 144 | 145 | *) 146 | printf "Not a valid command. Type 'tusker help' for usage.\n" 147 | ;; 148 | 149 | esac 150 | } 151 | 152 | main "$@" 153 | --------------------------------------------------------------------------------