A file-based task manager

WIP: parsing

+230 -10
+159 -9
Cargo.lock
··· 135 checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" 136 137 [[package]] 138 name = "edit" 139 version = "0.1.5" 140 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 167 checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" 168 169 [[package]] 170 name = "heck" 171 version = "0.5.0" 172 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 182 ] 183 184 [[package]] 185 name = "is_terminal_polyfill" 186 version = "1.70.1" 187 source = "registry+https://github.com/rust-lang/crates.io-index" 188 checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" 189 190 [[package]] 191 name = "libc" ··· 216 version = "1.20.2" 217 source = "registry+https://github.com/rust-lang/crates.io-index" 218 checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" 219 220 [[package]] 221 name = "proc-macro2" ··· 305 ] 306 307 [[package]] 308 name = "tsk" 309 version = "0.1.0" 310 dependencies = [ 311 "clap", 312 "clap_complete", 313 "clap_mangen", 314 "edit", 315 "nix", 316 "thiserror", 317 "xattr", 318 ] 319 320 [[package]] 321 name = "unicode-ident" 322 version = "1.0.13" 323 source = "registry+https://github.com/rust-lang/crates.io-index" 324 checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" 325 326 [[package]] 327 name = "utf8parse" ··· 343 344 [[package]] 345 name = "windows-sys" 346 version = "0.52.0" 347 source = "registry+https://github.com/rust-lang/crates.io-index" 348 checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 349 dependencies = [ 350 - "windows-targets", 351 ] 352 353 [[package]] ··· 356 source = "registry+https://github.com/rust-lang/crates.io-index" 357 checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 358 dependencies = [ 359 - "windows-targets", 360 ] 361 362 [[package]] ··· 365 source = "registry+https://github.com/rust-lang/crates.io-index" 366 checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 367 dependencies = [ 368 - "windows_aarch64_gnullvm", 369 - "windows_aarch64_msvc", 370 - "windows_i686_gnu", 371 "windows_i686_gnullvm", 372 - "windows_i686_msvc", 373 - "windows_x86_64_gnu", 374 - "windows_x86_64_gnullvm", 375 - "windows_x86_64_msvc", 376 ] 377 378 [[package]] 379 name = "windows_aarch64_gnullvm" 380 version = "0.52.6" 381 source = "registry+https://github.com/rust-lang/crates.io-index" 382 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 383 384 [[package]] 385 name = "windows_aarch64_msvc" 386 version = "0.52.6" 387 source = "registry+https://github.com/rust-lang/crates.io-index" 388 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 389 390 [[package]] 391 name = "windows_i686_gnu" ··· 401 402 [[package]] 403 name = "windows_i686_msvc" 404 version = "0.52.6" 405 source = "registry+https://github.com/rust-lang/crates.io-index" 406 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 407 408 [[package]] 409 name = "windows_x86_64_gnu" 410 version = "0.52.6" 411 source = "registry+https://github.com/rust-lang/crates.io-index" 412 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 413 414 [[package]] 415 name = "windows_x86_64_gnullvm" 416 version = "0.52.6" 417 source = "registry+https://github.com/rust-lang/crates.io-index" 418 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 419 420 [[package]] 421 name = "windows_x86_64_msvc"
··· 135 checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" 136 137 [[package]] 138 + name = "colored" 139 + version = "2.1.0" 140 + source = "registry+https://github.com/rust-lang/crates.io-index" 141 + checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" 142 + dependencies = [ 143 + "lazy_static", 144 + "windows-sys 0.48.0", 145 + ] 146 + 147 + [[package]] 148 name = "edit" 149 version = "0.1.5" 150 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 177 checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" 178 179 [[package]] 180 + name = "form_urlencoded" 181 + version = "1.2.1" 182 + source = "registry+https://github.com/rust-lang/crates.io-index" 183 + checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 184 + dependencies = [ 185 + "percent-encoding", 186 + ] 187 + 188 + [[package]] 189 name = "heck" 190 version = "0.5.0" 191 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 201 ] 202 203 [[package]] 204 + name = "idna" 205 + version = "0.5.0" 206 + source = "registry+https://github.com/rust-lang/crates.io-index" 207 + checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" 208 + dependencies = [ 209 + "unicode-bidi", 210 + "unicode-normalization", 211 + ] 212 + 213 + [[package]] 214 name = "is_terminal_polyfill" 215 version = "1.70.1" 216 source = "registry+https://github.com/rust-lang/crates.io-index" 217 checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" 218 + 219 + [[package]] 220 + name = "lazy_static" 221 + version = "1.5.0" 222 + source = "registry+https://github.com/rust-lang/crates.io-index" 223 + checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 224 225 [[package]] 226 name = "libc" ··· 251 version = "1.20.2" 252 source = "registry+https://github.com/rust-lang/crates.io-index" 253 checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" 254 + 255 + [[package]] 256 + name = "percent-encoding" 257 + version = "2.3.1" 258 + source = "registry+https://github.com/rust-lang/crates.io-index" 259 + checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 260 261 [[package]] 262 name = "proc-macro2" ··· 346 ] 347 348 [[package]] 349 + name = "tinyvec" 350 + version = "1.8.0" 351 + source = "registry+https://github.com/rust-lang/crates.io-index" 352 + checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" 353 + dependencies = [ 354 + "tinyvec_macros", 355 + ] 356 + 357 + [[package]] 358 + name = "tinyvec_macros" 359 + version = "0.1.1" 360 + source = "registry+https://github.com/rust-lang/crates.io-index" 361 + checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 362 + 363 + [[package]] 364 name = "tsk" 365 version = "0.1.0" 366 dependencies = [ 367 "clap", 368 "clap_complete", 369 "clap_mangen", 370 + "colored", 371 "edit", 372 "nix", 373 "thiserror", 374 + "url", 375 "xattr", 376 ] 377 378 [[package]] 379 + name = "unicode-bidi" 380 + version = "0.3.17" 381 + source = "registry+https://github.com/rust-lang/crates.io-index" 382 + checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" 383 + 384 + [[package]] 385 name = "unicode-ident" 386 version = "1.0.13" 387 source = "registry+https://github.com/rust-lang/crates.io-index" 388 checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" 389 + 390 + [[package]] 391 + name = "unicode-normalization" 392 + version = "0.1.24" 393 + source = "registry+https://github.com/rust-lang/crates.io-index" 394 + checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" 395 + dependencies = [ 396 + "tinyvec", 397 + ] 398 + 399 + [[package]] 400 + name = "url" 401 + version = "2.5.2" 402 + source = "registry+https://github.com/rust-lang/crates.io-index" 403 + checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" 404 + dependencies = [ 405 + "form_urlencoded", 406 + "idna", 407 + "percent-encoding", 408 + ] 409 410 [[package]] 411 name = "utf8parse" ··· 427 428 [[package]] 429 name = "windows-sys" 430 + version = "0.48.0" 431 + source = "registry+https://github.com/rust-lang/crates.io-index" 432 + checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 433 + dependencies = [ 434 + "windows-targets 0.48.5", 435 + ] 436 + 437 + [[package]] 438 + name = "windows-sys" 439 version = "0.52.0" 440 source = "registry+https://github.com/rust-lang/crates.io-index" 441 checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 442 dependencies = [ 443 + "windows-targets 0.52.6", 444 ] 445 446 [[package]] ··· 449 source = "registry+https://github.com/rust-lang/crates.io-index" 450 checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 451 dependencies = [ 452 + "windows-targets 0.52.6", 453 + ] 454 + 455 + [[package]] 456 + name = "windows-targets" 457 + version = "0.48.5" 458 + source = "registry+https://github.com/rust-lang/crates.io-index" 459 + checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 460 + dependencies = [ 461 + "windows_aarch64_gnullvm 0.48.5", 462 + "windows_aarch64_msvc 0.48.5", 463 + "windows_i686_gnu 0.48.5", 464 + "windows_i686_msvc 0.48.5", 465 + "windows_x86_64_gnu 0.48.5", 466 + "windows_x86_64_gnullvm 0.48.5", 467 + "windows_x86_64_msvc 0.48.5", 468 ] 469 470 [[package]] ··· 473 source = "registry+https://github.com/rust-lang/crates.io-index" 474 checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 475 dependencies = [ 476 + "windows_aarch64_gnullvm 0.52.6", 477 + "windows_aarch64_msvc 0.52.6", 478 + "windows_i686_gnu 0.52.6", 479 "windows_i686_gnullvm", 480 + "windows_i686_msvc 0.52.6", 481 + "windows_x86_64_gnu 0.52.6", 482 + "windows_x86_64_gnullvm 0.52.6", 483 + "windows_x86_64_msvc 0.52.6", 484 ] 485 486 [[package]] 487 name = "windows_aarch64_gnullvm" 488 + version = "0.48.5" 489 + source = "registry+https://github.com/rust-lang/crates.io-index" 490 + checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 491 + 492 + [[package]] 493 + name = "windows_aarch64_gnullvm" 494 version = "0.52.6" 495 source = "registry+https://github.com/rust-lang/crates.io-index" 496 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 497 498 [[package]] 499 name = "windows_aarch64_msvc" 500 + version = "0.48.5" 501 + source = "registry+https://github.com/rust-lang/crates.io-index" 502 + checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 503 + 504 + [[package]] 505 + name = "windows_aarch64_msvc" 506 version = "0.52.6" 507 source = "registry+https://github.com/rust-lang/crates.io-index" 508 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 509 + 510 + [[package]] 511 + name = "windows_i686_gnu" 512 + version = "0.48.5" 513 + source = "registry+https://github.com/rust-lang/crates.io-index" 514 + checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 515 516 [[package]] 517 name = "windows_i686_gnu" ··· 527 528 [[package]] 529 name = "windows_i686_msvc" 530 + version = "0.48.5" 531 + source = "registry+https://github.com/rust-lang/crates.io-index" 532 + checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 533 + 534 + [[package]] 535 + name = "windows_i686_msvc" 536 version = "0.52.6" 537 source = "registry+https://github.com/rust-lang/crates.io-index" 538 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 539 540 [[package]] 541 name = "windows_x86_64_gnu" 542 + version = "0.48.5" 543 + source = "registry+https://github.com/rust-lang/crates.io-index" 544 + checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 545 + 546 + [[package]] 547 + name = "windows_x86_64_gnu" 548 version = "0.52.6" 549 source = "registry+https://github.com/rust-lang/crates.io-index" 550 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 551 552 [[package]] 553 name = "windows_x86_64_gnullvm" 554 + version = "0.48.5" 555 + source = "registry+https://github.com/rust-lang/crates.io-index" 556 + checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 557 + 558 + [[package]] 559 + name = "windows_x86_64_gnullvm" 560 version = "0.52.6" 561 source = "registry+https://github.com/rust-lang/crates.io-index" 562 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 563 + 564 + [[package]] 565 + name = "windows_x86_64_msvc" 566 + version = "0.48.5" 567 + source = "registry+https://github.com/rust-lang/crates.io-index" 568 + checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 569 570 [[package]] 571 name = "windows_x86_64_msvc"
+2
Cargo.toml
··· 9 edit = "0.1.5" 10 nix = { version = "0.29.0", features = ["fs"] } 11 thiserror = "1.0.64" 12 xattr = "1.3.1" 13 14 [build-dependencies] 15 clap_mangen = "0.2.23"
··· 9 edit = "0.1.5" 10 nix = { version = "0.29.0", features = ["fs"] } 11 thiserror = "1.0.64" 12 + url = "2.5.2" 13 xattr = "1.3.1" 14 + colored = "2.1.0" 15 16 [build-dependencies] 17 clap_mangen = "0.2.23"
+15 -1
readme
··· 33 Task-level metadata requires Linux's xattr(7) API and a filesystem that supports 34 it. Patches that implement this for other operating systems are welcome. 35 36 Building 37 -------- 38 39 - ```shell 40 cargo install --path . 41 ``` 42 ··· 154 155 Additionally, it should be similar enough to Markdown such that it is easy to 156 export to other applications, as outlined above in the roadmap. 157 158 A core feature of the format is *linking*. That is, references to other tasks 159 utilizing wiki-link style links: `[[]]`. The content within the link is mapped
··· 33 Task-level metadata requires Linux's xattr(7) API and a filesystem that supports 34 it. Patches that implement this for other operating systems are welcome. 35 36 + tsk expects to run on POSIX-like systems. Microsoft Windows and other 37 + non-UNIX-ey operating systems will never be directly supported. 38 + 39 Building 40 -------- 41 42 + ```sh 43 cargo install --path . 44 ``` 45 ··· 157 158 Additionally, it should be similar enough to Markdown such that it is easy to 159 export to other applications, as outlined above in the roadmap. 160 + 161 + Meanwhile, both Markdown and scdoc have some limitations and make choices that, 162 + while appropriate for their domain, are not appropriate for tsk. Some notable 163 + differences from both: 164 + 165 + - There is only one way to do any type of formatting 166 + - Hard line breaks are real, not imaginary 167 + - Most formatting does not cross line boundaries (literal blocks are an 168 + exception) 169 + - Parseable with a context-free grammar 170 + - Inline formatting control characters must be surrounded by white-space 171 172 A core feature of the format is *linking*. That is, references to other tasks 173 utilizing wiki-link style links: `[[]]`. The content within the link is mapped
+1
src/main.rs
··· 4 mod stack; 5 mod util; 6 mod workspace; 7 use clap_complete::{generate, Shell}; 8 use errors::Result; 9 use std::io;
··· 4 mod stack; 5 mod util; 6 mod workspace; 7 + mod task; 8 use clap_complete::{generate, Shell}; 9 use errors::Result; 10 use std::io;
+52
src/task.rs
···
··· 1 + #![allow(dead_code)] 2 + use url::Url; 3 + 4 + use crate::workspace::Id; 5 + 6 + /// An AST node parsed from the plain-text representation of 7 + enum TaskASTNode<'n> { 8 + /// Unmodified text 9 + Plain(&'n str), 10 + /// Text that has been highlighted using =test= syntax. 11 + Highlight(Box<TaskASTNode<'n>>), 12 + /// A standard Markdown-style link 13 + Link { 14 + text: Box<TaskASTNode<'n>>, 15 + to: Url, 16 + }, 17 + /// An internal link to another task using custom [[tsk-id]] syntax 18 + InternalLink(Id), 19 + /// Italicized text using Markdown *text* syntax. 20 + Italics(Box<TaskASTNode<'n>>), 21 + /// Bolded text using !text! syntax. 22 + Bold(Box<TaskASTNode<'n>>), 23 + /// Underlined text using custom _text_ syntax. 24 + Underline(Box<TaskASTNode<'n>>), 25 + /// Strikethrough using -text- syntax 26 + Strikethrough(Box<TaskASTNode<'n>>), 27 + /// Unordered list using Markdown * list-item syntax 28 + UnorderedList(Vec<TaskASTNode<'n>>), 29 + /// Ordered list using Markdown 1. list-item syntax 30 + OrderedList(Vec<TaskASTNode<'n>>), 31 + /// Literal block using markdown triple-backtick syntax. 32 + Block { 33 + /// An optional syntax specifier. This *may* be used to apply syntax formatting to contents 34 + /// in the future 35 + syntax: Option<&'n str>, 36 + /// The verbatim content of the block 37 + content: &'n str, 38 + }, 39 + /// Literal block using markdown single-backtick syntax. 40 + InlineBlock(&'n str), 41 + /// Blockquotes using Markdown > quote syntax 42 + Blockquote(&'n str), 43 + } 44 + 45 + impl<'i> TaskASTNode<'i> { 46 + fn parse(s: &'i String) -> Result<Vec<TaskASTNode<'i>>, String> { 47 + let i = 0; 48 + let mut roots: Vec<TaskASTNode<'i>> = Vec::new(); 49 + 50 + todo!(); 51 + } 52 + }
+1
src/workspace.rs
··· 216 return Ok(()); 217 } 218 219 stack.push(second.unwrap()); 220 stack.push(top.unwrap()); 221 stack.push(third.unwrap());
··· 216 return Ok(()); 217 } 218 219 + // unwrap is ok here because we checked above 220 stack.push(second.unwrap()); 221 stack.push(top.unwrap()); 222 stack.push(third.unwrap());