How to use the command 'tod' (with examples)
- Linux
- December 25, 2023
Tod is a tiny Todoist client in Rust that allows you to manage your tasks using simple input commands. It leverages natural language processing to assign due dates, tags, and more. In this article, we will explore different use cases of the ’tod’ command.
Use case 1: Import your projects
Code:
tod project import
Motivation:
You may want to import your projects to enable project prompts and organize your tasks efficiently. By importing your projects, you can associate tasks with specific projects for better categorization and management.
Explanation:
The command ’tod project import’ is used to import your projects into the Tod client. This command sets up the necessary configuration to enable project prompts when creating or manipulating tasks.
Example output:
Projects imported successfully.
Use case 2: Quickly create a task with due date
Code:
tod --quickadd Buy more milk today
Motivation:
When you have an urgent task that needs to be completed by a specific date, using the ‘–quickadd’ flag allows you to create a task quickly without going through additional prompts. This is especially useful for time-sensitive tasks.
Explanation:
The command ’tod –quickadd <task_content>’ is used to quickly create a task with a due date. By specifying the task content directly after the ‘–quickadd’ flag, you can create a task and assign it a due date in a single command.
Example output:
Task 'Buy more milk' created successfully with a due date of today.
Use case 3: Create a new task
Code:
tod task create
Motivation:
When you want to create a new task and provide additional details such as project association, due date, and tags, you can use the ’tod task create’ command. This allows you to have full control over creating a task with specific attributes.
Explanation:
The command ’tod task create’ prompts you for the content of the task and the project to associate it with. This interactive command allows you to provide detailed information and set preferences for your task.
Example output:
Enter task content: Write an article
Enter project name (optional):
Task 'Write an article' created successfully.
Use case 4: Create a task in a project
Code:
tod task create --content "Write more rust" --project code
Motivation:
When you have multiple projects and want to create a task directly associated with a specific project, you can use the ‘–project’ flag to indicate the project for the task. This helps in organizing and managing tasks within their respective projects.
Explanation:
The command ’tod task create –content <task_content> –project <project_name>’ creates a task with the given content and associates it with the specified project. By including the ‘–project’ flag followed by the project name, you can ensure that the task is created in the desired project.
Example output:
Task 'Write more rust' created successfully in the 'code' project.
Use case 5: Get the next task for a project
Code:
tod task next
Motivation:
When you want to focus on the next upcoming task in a specific project, you can use the ’tod task next’ command. This helps in prioritizing tasks and staying organized by providing you with the most relevant task to work on.
Explanation:
The command ’tod task next’ retrieves the next task to be completed in the default project. By default, the next task is determined based on the due date and other factors such as priority. It allows you to efficiently track and complete tasks in a structured manner.
Example output:
Next task: 'Review project proposal' (due date: 2022-05-20)
Use case 6: Get your work schedule
Code:
tod task list --scheduled --project work
Motivation:
When you want to view your work schedule and the tasks that are scheduled for specific dates, you can use the ’tod task list’ command with the ‘–scheduled’ flag. This allows you to plan your workday effectively and prioritize tasks accordingly.
Explanation:
The command ’tod task list –scheduled –project <project_name>’ lists all the tasks in the specified project that have a scheduled due date. By including the ‘–scheduled’ flag, you can filter the tasks based on their scheduled due dates, giving you an overview of your work schedule.
Example output:
Scheduled tasks for 'work':
- Attend meeting (due date: 2022-05-23)
- Submit report (due date: 2022-05-24)
Use case 7: Get all tasks for work
Code:
tod task list --project work
Motivation:
When you want to view all the tasks associated with a particular project, you can use the ’tod task list’ command with the ‘–project’ flag. This helps you get a comprehensive overview of all the tasks related to a specific project.
Explanation:
The command ’tod task list –project <project_name>’ lists all the tasks in the specified project, regardless of their due dates. By including the ‘–project’ flag followed by the project name, you can filter the tasks and view only the tasks associated with that project.
Example output:
Tasks for 'work':
- Attend meeting (due date: 2022-05-23)
- Submit report (due date: 2022-05-24)
- Prepare presentation (due date: 2022-05-25)
Conclusion:
The ’tod’ command offers a convenient way to manage tasks using simple input commands. By understanding its various use cases, you can effectively create, organize, and track your tasks using the Tod client. Whether you need to import projects, create tasks with due dates, or view task lists for specific projects, the ’tod’ command has you covered.