1
0
Fork
You've already forked mt
0

v2 - Summit #5

Open
opened 2024年11月06日 20:19:48 +01:00 by simenandre · 0 comments
simenandre commented 2024年11月06日 20:19:48 +01:00 (Migrated from github.com)
Copy link

I have decided to rebuild the project in Zig. I would love to have a reason to learn Zig and to use it for something. This project feels like something that would fit the bill.

Let me introduce you to the next version of mt, codename Summit.

I have a few wishes for the implementation:

  • Support/be interoperable with task management features as Obsidian Task Management
  • Support similar tasks querying as Obsidian Task Management has
  • Creating tasks (maybe have configured groups, i.e. mt group create helloworld -d /path/to/project)
  • Support TODOs from all kinds of files (like TODO: Keep this going), not just Markdown like today. (We might need to cache/keep an index)
  • Option to create daily task files when adding tasks (adding to directory/YYYY-MM-DD.md), just a simple TODO.md or others?

Potential API for the CLI

mt [command]

If no command is provided, mt will list all tasks in the current directory or the
global note directory if one is configured. If you have configured a global note
directory, you can also specify a different directory to list tasks from:

mt -d ~/notes

Add a task

mt add "Buy milk"

Assuming you have configured a global note directory, this command will add a
new task to the daily note for today. If not, it will add it to TODO.md in the
current directory. You can also specify a different file to add the task to:

mt add "Buy milk" -f ~/notes/TODO.md

You can also add a due date to the task:

mt add "Buy milk" -d 2021年12月31日

The output of this command will be in the format of:

- [ ] Buy milk 📅 2021年04月09日

You can also add a priority to the task:

mt add "Buy milk" -p 1

The priorites can be from 1 to 6, with 1 being the highest priority. You can also
write lowest (6), low (5), none (4), medium (3), high (2) or highest (1) instead.

The output of this command will be in the format of:

- [ ] Buy milk 🔺

Editing a task (i.e. completing it)

I want an interactive mode for editing, but also something that works in the terminal (and can be scripted).

It might be something like:

mt complete 1

List tasks

mt list

Or, just mt with no command. You can specify a different directly to list tasks from:

mt list -d ~/notes

Or mt -d ~/notes with no command. We also have a short version of the command:

mt l

To list all tasks in the current directory, you can use:

mt lc

Tasks

Phase 1: Setup and Core Functionality

Get started with everything, including some form of releasing (and installing).

Basics

  • Set up the project structure (e.g., src/, tests/, etc.).
  • Configure the build system using Zig's build tools (build.zig).
  • Implement a basic CLI framework to handle commands and flags.
  • Release on Homebrew?

File Handling

  • Write functionality to scan a given directory for files.
  • Filter files to only include Markdown files (.md)

Task Extraction

  • Parse files to extract lines starting with
  • (Markdown tasks).
  • Support alternative formats, e.g., lines containing "TODO:".
  • Collect all tasks into a data structure.

Phase 2: Task Parsing and Enrichment

  • Find files with "TODO:" sections.

Task Parsing

  • Parse basic task details (description, completion status).
  • Parse emojis for metadata (e.g., 📅 for due dates).
  • Parse priority levels from Markdown (🔺, or from flags like -p).

Data Structure

  • Define a Task struct with fields like:
description: []u8
dueDate: ?Date
priority: u8
completed: bool
sourceFile: []u8
  • Define a TaskList struct for managing multiple tasks.

Phase 3: Command Functionality

List Tasks

  • Implement mt list (or mt) to display tasks.
  • Support flags for filtering (e.g., by directory -d).

Add Tasks

  • Implement mt add to add a new task to the default or specified file.
  • Support additional options:
    • -d for due dates.
    • -p for priorities.
    • -f to specify a target file.

Complete Tasks

  • Implement mt complete <task_id> to mark tasks as completed.
  • Support editing tasks directly in files.

Interactive Mode

  • Add an interactive mode for editing tasks (mt edit or mt complete with TUI).

Phase 4: Testing, Docs and Optimizing(?)

Testing

  • Write unit tests for core functionalities (e.g., parsing, querying).
  • Write integration tests for CLI commands.

Performance

  • Profile the tool for performance bottlenecks.
  • Optimize file parsing and task querying.

Documentation

  • Update README.md with usage examples.
  • Add comments and inline documentation in the code.

Phase 5: Advancing?

Caching

  • Implement a simple caching system for tasks.
  • Use caching to improve performance for repeated queries.

Recurring Tasks

  • Add support for recurring tasks using Obsidian-style syntax.
  • Parse recurring rules and auto-generate future tasks.

Customization

  • Allow user configuration for:
    • Global note directory.
    • Task priority labels.
    • Default output format.
I have decided to rebuild the project in Zig. I would love to have a reason to learn Zig and to use it for something. This project feels like something that would fit the bill. Let me introduce you to the next version of `mt`, codename **Summit**. I have a few wishes for the implementation: - Support/be interoperable with _task management features_ as [Obsidian Task Management](https://publish.obsidian.md/tasks/Getting+Started/Introduction) - Support similar tasks [querying as Obsidian Task Management has](https://publish.obsidian.md/tasks/Queries/About+Queries) - Creating tasks (maybe have configured _groups_, i.e. `mt group create helloworld -d /path/to/project`) - Support `TODO`s from all kinds of files (like `TODO: Keep this going`), not just Markdown like today. (We might need to cache/keep an index) - Option to create daily task files when adding tasks (adding to `directory/YYYY-MM-DD.md`), just a simple `TODO.md` or others? ## Potential API for the CLI ```sh mt [command] ``` If no command is provided, `mt` will list all tasks in the current directory or the global note directory if one is configured. If you have configured a global note directory, you can also specify a different directory to list tasks from: ```sh mt -d ~/notes ``` ### Add a task ```sh mt add "Buy milk" ``` Assuming you have configured a global note directory, this command will add a new task to the daily note for today. If not, it will add it to `TODO.md` in the current directory. You can also specify a different file to add the task to: ```sh mt add "Buy milk" -f ~/notes/TODO.md ``` You can also add a due date to the task: ```sh mt add "Buy milk" -d 2021年12月31日 ``` The output of this command will be in the format of: ```markdown - [ ] Buy milk 📅 2021年04月09日 ``` You can also add a priority to the task: ```sh mt add "Buy milk" -p 1 ``` The priorites can be from 1 to 6, with 1 being the highest priority. You can also write lowest (6), low (5), none (4), medium (3), high (2) or highest (1) instead. The output of this command will be in the format of: ```markdown - [ ] Buy milk 🔺 ``` ### Editing a task (i.e. completing it) I want an interactive mode for editing, but also something that works in the terminal (and can be scripted). It might be something like: ```sh mt complete 1 ``` ### List tasks ```sh mt list ``` Or, just `mt` with no command. You can specify a different directly to list tasks from: ```sh mt list -d ~/notes ``` Or `mt -d ~/notes` with no command. We also have a short version of the command: ```sh mt l ``` To list all tasks in the current directory, you can use: ```sh mt lc ``` ### Tasks #### Phase 1: Setup and Core Functionality Get started with everything, including some form of releasing (and installing). Basics - [x] Set up the project structure (e.g., src/, tests/, etc.). - [x] Configure the build system using Zig's build tools (build.zig). - [x] Implement a basic CLI framework to handle commands and flags. - [ ] Release on Homebrew? File Handling - [ ] Write functionality to scan a given directory for files. - [ ] Filter files to only include Markdown files (.md) Task Extraction - [ ] Parse files to extract lines starting with - [ ] (Markdown tasks). - [ ] Support alternative formats, e.g., lines containing "TODO:". - [ ] Collect all tasks into a data structure. #### Phase 2: Task Parsing and Enrichment - [ ] Find files with "TODO:" sections. Task Parsing - [ ] Parse basic task details (description, completion status). - [ ] Parse emojis for metadata (e.g., 📅 for due dates). - [ ] Parse priority levels from Markdown (🔺, or from flags like -p). Data Structure - [ ] Define a Task struct with fields like: ``` description: []u8 dueDate: ?Date priority: u8 completed: bool sourceFile: []u8 ``` - [ ] Define a TaskList struct for managing multiple tasks. #### Phase 3: Command Functionality List Tasks - [ ] Implement mt list (or mt) to display tasks. - [ ] Support flags for filtering (e.g., by directory -d). Add Tasks - [ ] Implement mt add <task> to add a new task to the default or specified file. - [ ] Support additional options: - -d <date> for due dates. - -p <priority> for priorities. - -f <file> to specify a target file. Complete Tasks - [ ] Implement mt complete <task_id> to mark tasks as completed. - [ ] Support editing tasks directly in files. Interactive Mode - [ ] Add an interactive mode for editing tasks (mt edit or mt complete with TUI). #### Phase 4: Testing, Docs and Optimizing(?) Testing - [ ] Write unit tests for core functionalities (e.g., parsing, querying). - [ ] Write integration tests for CLI commands. Performance - [ ] Profile the tool for performance bottlenecks. - [ ] Optimize file parsing and task querying. Documentation - [ ] Update README.md with usage examples. - [ ] Add comments and inline documentation in the code. #### Phase 5: Advancing? Caching - [ ] Implement a simple caching system for tasks. - [ ] Use caching to improve performance for repeated queries. Recurring Tasks - [ ] Add support for recurring tasks using Obsidian-style syntax. - [ ] Parse recurring rules and auto-generate future tasks. Customization - [ ] Allow user configuration for: - Global note directory. - Task priority labels. - Default output format.
Sign in to join this conversation.
No Branch/Tag specified
main
ziggy
dependabot/go_modules/golang.org/x/net-0.23.0
renovate/configure
v0.0.2
v0.0.1
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
simenandre/mt#5
Reference in a new issue
simenandre/mt
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?