A file-based task manager

WIP: parsing

+230 -10
+159 -9
Cargo.lock
··· 135 135 checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" 136 136 137 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]] 138 148 name = "edit" 139 149 version = "0.1.5" 140 150 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 167 177 checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" 168 178 169 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]] 170 189 name = "heck" 171 190 version = "0.5.0" 172 191 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 182 201 ] 183 202 184 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]] 185 214 name = "is_terminal_polyfill" 186 215 version = "1.70.1" 187 216 source = "registry+https://github.com/rust-lang/crates.io-index" 188 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" 189 224 190 225 [[package]] 191 226 name = "libc" ··· 216 251 version = "1.20.2" 217 252 source = "registry+https://github.com/rust-lang/crates.io-index" 218 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" 219 260 220 261 [[package]] 221 262 name = "proc-macro2" ··· 305 346 ] 306 347 307 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]] 308 364 name = "tsk" 309 365 version = "0.1.0" 310 366 dependencies = [ 311 367 "clap", 312 368 "clap_complete", 313 369 "clap_mangen", 370 + "colored", 314 371 "edit", 315 372 "nix", 316 373 "thiserror", 374 + "url", 317 375 "xattr", 318 376 ] 319 377 320 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]] 321 385 name = "unicode-ident" 322 386 version = "1.0.13" 323 387 source = "registry+https://github.com/rust-lang/crates.io-index" 324 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 + ] 325 409 326 410 [[package]] 327 411 name = "utf8parse" ··· 343 427 344 428 [[package]] 345 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" 346 439 version = "0.52.0" 347 440 source = "registry+https://github.com/rust-lang/crates.io-index" 348 441 checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 349 442 dependencies = [ 350 - "windows-targets", 443 + "windows-targets 0.52.6", 351 444 ] 352 445 353 446 [[package]] ··· 356 449 source = "registry+https://github.com/rust-lang/crates.io-index" 357 450 checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 358 451 dependencies = [ 359 - "windows-targets", 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", 360 468 ] 361 469 362 470 [[package]] ··· 365 473 source = "registry+https://github.com/rust-lang/crates.io-index" 366 474 checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 367 475 dependencies = [ 368 - "windows_aarch64_gnullvm", 369 - "windows_aarch64_msvc", 370 - "windows_i686_gnu", 476 + "windows_aarch64_gnullvm 0.52.6", 477 + "windows_aarch64_msvc 0.52.6", 478 + "windows_i686_gnu 0.52.6", 371 479 "windows_i686_gnullvm", 372 - "windows_i686_msvc", 373 - "windows_x86_64_gnu", 374 - "windows_x86_64_gnullvm", 375 - "windows_x86_64_msvc", 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", 376 484 ] 377 485 378 486 [[package]] 379 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" 380 494 version = "0.52.6" 381 495 source = "registry+https://github.com/rust-lang/crates.io-index" 382 496 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 383 497 384 498 [[package]] 385 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" 386 506 version = "0.52.6" 387 507 source = "registry+https://github.com/rust-lang/crates.io-index" 388 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" 389 515 390 516 [[package]] 391 517 name = "windows_i686_gnu" ··· 401 527 402 528 [[package]] 403 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" 404 536 version = "0.52.6" 405 537 source = "registry+https://github.com/rust-lang/crates.io-index" 406 538 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 407 539 408 540 [[package]] 409 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" 410 548 version = "0.52.6" 411 549 source = "registry+https://github.com/rust-lang/crates.io-index" 412 550 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 413 551 414 552 [[package]] 415 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" 416 560 version = "0.52.6" 417 561 source = "registry+https://github.com/rust-lang/crates.io-index" 418 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" 419 569 420 570 [[package]] 421 571 name = "windows_x86_64_msvc"
+2
Cargo.toml
··· 9 9 edit = "0.1.5" 10 10 nix = { version = "0.29.0", features = ["fs"] } 11 11 thiserror = "1.0.64" 12 + url = "2.5.2" 12 13 xattr = "1.3.1" 14 + colored = "2.1.0" 13 15 14 16 [build-dependencies] 15 17 clap_mangen = "0.2.23"
+15 -1
readme
··· 33 33 Task-level metadata requires Linux's xattr(7) API and a filesystem that supports 34 34 it. Patches that implement this for other operating systems are welcome. 35 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 + 36 39 Building 37 40 -------- 38 41 39 - ```shell 42 + ```sh 40 43 cargo install --path . 41 44 ``` 42 45 ··· 154 157 155 158 Additionally, it should be similar enough to Markdown such that it is easy to 156 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 157 171 158 172 A core feature of the format is *linking*. That is, references to other tasks 159 173 utilizing wiki-link style links: `[[]]`. The content within the link is mapped
+1
src/main.rs
··· 4 4 mod stack; 5 5 mod util; 6 6 mod workspace; 7 + mod task; 7 8 use clap_complete::{generate, Shell}; 8 9 use errors::Result; 9 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 216 return Ok(()); 217 217 } 218 218 219 + // unwrap is ok here because we checked above 219 220 stack.push(second.unwrap()); 220 221 stack.push(top.unwrap()); 221 222 stack.push(third.unwrap());