A file-based task manager

ADD: append command. Create low priority tasks!

+88 -122
+42 -117
Cargo.lock
··· 1 # This file is automatically @generated by Cargo. 2 # It is not intended for manual editing. 3 - version = 4 4 5 [[package]] 6 name = "anstream" ··· 38 source = "registry+https://github.com/rust-lang/crates.io-index" 39 checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" 40 dependencies = [ 41 - "windows-sys 0.59.0", 42 ] 43 44 [[package]] ··· 48 checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" 49 dependencies = [ 50 "anstyle", 51 - "windows-sys 0.59.0", 52 ] 53 54 [[package]] ··· 71 72 [[package]] 73 name = "clap" 74 - version = "4.5.22" 75 source = "registry+https://github.com/rust-lang/crates.io-index" 76 - checksum = "69371e34337c4c984bbe322360c2547210bf632eb2814bbe78a6e87a2935bd2b" 77 dependencies = [ 78 "clap_builder", 79 "clap_derive", ··· 81 82 [[package]] 83 name = "clap_builder" 84 - version = "4.5.22" 85 source = "registry+https://github.com/rust-lang/crates.io-index" 86 - checksum = "6e24c1b4099818523236a8ca881d2b45db98dadfb4625cf6608c12069fcbbde1" 87 dependencies = [ 88 "anstream", 89 "anstyle", ··· 93 94 [[package]] 95 name = "clap_complete" 96 - version = "4.5.38" 97 source = "registry+https://github.com/rust-lang/crates.io-index" 98 - checksum = "d9647a559c112175f17cf724dc72d3645680a883c58481332779192b0d8e7a01" 99 dependencies = [ 100 "clap", 101 ] ··· 114 115 [[package]] 116 name = "clap_lex" 117 - version = "0.7.3" 118 source = "registry+https://github.com/rust-lang/crates.io-index" 119 - checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" 120 121 [[package]] 122 name = "clap_mangen" ··· 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]] ··· 178 checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" 179 dependencies = [ 180 "libc", 181 - "windows-sys 0.59.0", 182 ] 183 184 [[package]] 185 name = "fastrand" 186 - version = "2.2.0" 187 source = "registry+https://github.com/rust-lang/crates.io-index" 188 - checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" 189 190 [[package]] 191 name = "form_urlencoded" ··· 204 205 [[package]] 206 name = "home" 207 - version = "0.5.9" 208 source = "registry+https://github.com/rust-lang/crates.io-index" 209 - checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" 210 dependencies = [ 211 - "windows-sys 0.52.0", 212 ] 213 214 [[package]] ··· 392 393 [[package]] 394 name = "libc" 395 - version = "0.2.167" 396 source = "registry+https://github.com/rust-lang/crates.io-index" 397 - checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" 398 399 [[package]] 400 name = "linux-raw-sys" ··· 475 476 [[package]] 477 name = "rustix" 478 - version = "0.38.41" 479 source = "registry+https://github.com/rust-lang/crates.io-index" 480 - checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" 481 dependencies = [ 482 "bitflags", 483 "errno", 484 "libc", 485 "linux-raw-sys", 486 - "windows-sys 0.52.0", 487 ] 488 489 [[package]] 490 name = "serde" 491 - version = "1.0.215" 492 source = "registry+https://github.com/rust-lang/crates.io-index" 493 - checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" 494 dependencies = [ 495 "serde_derive", 496 ] 497 498 [[package]] 499 name = "serde_derive" 500 - version = "1.0.215" 501 source = "registry+https://github.com/rust-lang/crates.io-index" 502 - checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" 503 dependencies = [ 504 "proc-macro2", 505 "quote", ··· 556 "fastrand", 557 "once_cell", 558 "rustix", 559 - "windows-sys 0.59.0", 560 ] 561 562 [[package]] 563 name = "thiserror" 564 - version = "2.0.4" 565 source = "registry+https://github.com/rust-lang/crates.io-index" 566 - checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" 567 dependencies = [ 568 "thiserror-impl", 569 ] 570 571 [[package]] 572 name = "thiserror-impl" 573 - version = "2.0.4" 574 source = "registry+https://github.com/rust-lang/crates.io-index" 575 - checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" 576 dependencies = [ 577 "proc-macro2", 578 "quote", ··· 655 656 [[package]] 657 name = "windows-sys" 658 - version = "0.48.0" 659 - source = "registry+https://github.com/rust-lang/crates.io-index" 660 - checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 661 - dependencies = [ 662 - "windows-targets 0.48.5", 663 - ] 664 - 665 - [[package]] 666 - name = "windows-sys" 667 - version = "0.52.0" 668 - source = "registry+https://github.com/rust-lang/crates.io-index" 669 - checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 670 - dependencies = [ 671 - "windows-targets 0.52.6", 672 - ] 673 - 674 - [[package]] 675 - name = "windows-sys" 676 version = "0.59.0" 677 source = "registry+https://github.com/rust-lang/crates.io-index" 678 checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 679 dependencies = [ 680 - "windows-targets 0.52.6", 681 - ] 682 - 683 - [[package]] 684 - name = "windows-targets" 685 - version = "0.48.5" 686 - source = "registry+https://github.com/rust-lang/crates.io-index" 687 - checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 688 - dependencies = [ 689 - "windows_aarch64_gnullvm 0.48.5", 690 - "windows_aarch64_msvc 0.48.5", 691 - "windows_i686_gnu 0.48.5", 692 - "windows_i686_msvc 0.48.5", 693 - "windows_x86_64_gnu 0.48.5", 694 - "windows_x86_64_gnullvm 0.48.5", 695 - "windows_x86_64_msvc 0.48.5", 696 ] 697 698 [[package]] ··· 701 source = "registry+https://github.com/rust-lang/crates.io-index" 702 checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 703 dependencies = [ 704 - "windows_aarch64_gnullvm 0.52.6", 705 - "windows_aarch64_msvc 0.52.6", 706 - "windows_i686_gnu 0.52.6", 707 "windows_i686_gnullvm", 708 - "windows_i686_msvc 0.52.6", 709 - "windows_x86_64_gnu 0.52.6", 710 - "windows_x86_64_gnullvm 0.52.6", 711 - "windows_x86_64_msvc 0.52.6", 712 ] 713 714 [[package]] 715 name = "windows_aarch64_gnullvm" 716 - version = "0.48.5" 717 - source = "registry+https://github.com/rust-lang/crates.io-index" 718 - checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 719 - 720 - [[package]] 721 - name = "windows_aarch64_gnullvm" 722 version = "0.52.6" 723 source = "registry+https://github.com/rust-lang/crates.io-index" 724 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 725 726 [[package]] 727 name = "windows_aarch64_msvc" 728 - version = "0.48.5" 729 - source = "registry+https://github.com/rust-lang/crates.io-index" 730 - checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 731 - 732 - [[package]] 733 - name = "windows_aarch64_msvc" 734 version = "0.52.6" 735 source = "registry+https://github.com/rust-lang/crates.io-index" 736 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 737 738 [[package]] 739 name = "windows_i686_gnu" 740 - version = "0.48.5" 741 - source = "registry+https://github.com/rust-lang/crates.io-index" 742 - checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 743 - 744 - [[package]] 745 - name = "windows_i686_gnu" 746 version = "0.52.6" 747 source = "registry+https://github.com/rust-lang/crates.io-index" 748 checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" ··· 755 756 [[package]] 757 name = "windows_i686_msvc" 758 - version = "0.48.5" 759 - source = "registry+https://github.com/rust-lang/crates.io-index" 760 - checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 761 - 762 - [[package]] 763 - name = "windows_i686_msvc" 764 version = "0.52.6" 765 source = "registry+https://github.com/rust-lang/crates.io-index" 766 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 767 768 [[package]] 769 name = "windows_x86_64_gnu" 770 - version = "0.48.5" 771 - source = "registry+https://github.com/rust-lang/crates.io-index" 772 - checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 773 - 774 - [[package]] 775 - name = "windows_x86_64_gnu" 776 version = "0.52.6" 777 source = "registry+https://github.com/rust-lang/crates.io-index" 778 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 779 780 [[package]] 781 name = "windows_x86_64_gnullvm" 782 - version = "0.48.5" 783 - source = "registry+https://github.com/rust-lang/crates.io-index" 784 - checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 785 - 786 - [[package]] 787 - name = "windows_x86_64_gnullvm" 788 version = "0.52.6" 789 source = "registry+https://github.com/rust-lang/crates.io-index" 790 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 791 - 792 - [[package]] 793 - name = "windows_x86_64_msvc" 794 - version = "0.48.5" 795 - source = "registry+https://github.com/rust-lang/crates.io-index" 796 - checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 797 798 [[package]] 799 name = "windows_x86_64_msvc"
··· 1 # This file is automatically @generated by Cargo. 2 # It is not intended for manual editing. 3 + version = 3 4 5 [[package]] 6 name = "anstream" ··· 38 source = "registry+https://github.com/rust-lang/crates.io-index" 39 checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" 40 dependencies = [ 41 + "windows-sys", 42 ] 43 44 [[package]] ··· 48 checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" 49 dependencies = [ 50 "anstyle", 51 + "windows-sys", 52 ] 53 54 [[package]] ··· 71 72 [[package]] 73 name = "clap" 74 + version = "4.5.23" 75 source = "registry+https://github.com/rust-lang/crates.io-index" 76 + checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" 77 dependencies = [ 78 "clap_builder", 79 "clap_derive", ··· 81 82 [[package]] 83 name = "clap_builder" 84 + version = "4.5.23" 85 source = "registry+https://github.com/rust-lang/crates.io-index" 86 + checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" 87 dependencies = [ 88 "anstream", 89 "anstyle", ··· 93 94 [[package]] 95 name = "clap_complete" 96 + version = "4.5.39" 97 source = "registry+https://github.com/rust-lang/crates.io-index" 98 + checksum = "fd4db298d517d5fa00b2b84bbe044efd3fde43874a41db0d46f91994646a2da4" 99 dependencies = [ 100 "clap", 101 ] ··· 114 115 [[package]] 116 name = "clap_lex" 117 + version = "0.7.4" 118 source = "registry+https://github.com/rust-lang/crates.io-index" 119 + checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" 120 121 [[package]] 122 name = "clap_mangen" ··· 136 137 [[package]] 138 name = "colored" 139 + version = "2.2.0" 140 source = "registry+https://github.com/rust-lang/crates.io-index" 141 + checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" 142 dependencies = [ 143 "lazy_static", 144 + "windows-sys", 145 ] 146 147 [[package]] ··· 178 checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" 179 dependencies = [ 180 "libc", 181 + "windows-sys", 182 ] 183 184 [[package]] 185 name = "fastrand" 186 + version = "2.3.0" 187 source = "registry+https://github.com/rust-lang/crates.io-index" 188 + checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 189 190 [[package]] 191 name = "form_urlencoded" ··· 204 205 [[package]] 206 name = "home" 207 + version = "0.5.11" 208 source = "registry+https://github.com/rust-lang/crates.io-index" 209 + checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" 210 dependencies = [ 211 + "windows-sys", 212 ] 213 214 [[package]] ··· 392 393 [[package]] 394 name = "libc" 395 + version = "0.2.168" 396 source = "registry+https://github.com/rust-lang/crates.io-index" 397 + checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" 398 399 [[package]] 400 name = "linux-raw-sys" ··· 475 476 [[package]] 477 name = "rustix" 478 + version = "0.38.42" 479 source = "registry+https://github.com/rust-lang/crates.io-index" 480 + checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" 481 dependencies = [ 482 "bitflags", 483 "errno", 484 "libc", 485 "linux-raw-sys", 486 + "windows-sys", 487 ] 488 489 [[package]] 490 name = "serde" 491 + version = "1.0.216" 492 source = "registry+https://github.com/rust-lang/crates.io-index" 493 + checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" 494 dependencies = [ 495 "serde_derive", 496 ] 497 498 [[package]] 499 name = "serde_derive" 500 + version = "1.0.216" 501 source = "registry+https://github.com/rust-lang/crates.io-index" 502 + checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" 503 dependencies = [ 504 "proc-macro2", 505 "quote", ··· 556 "fastrand", 557 "once_cell", 558 "rustix", 559 + "windows-sys", 560 ] 561 562 [[package]] 563 name = "thiserror" 564 + version = "2.0.7" 565 source = "registry+https://github.com/rust-lang/crates.io-index" 566 + checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" 567 dependencies = [ 568 "thiserror-impl", 569 ] 570 571 [[package]] 572 name = "thiserror-impl" 573 + version = "2.0.7" 574 source = "registry+https://github.com/rust-lang/crates.io-index" 575 + checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" 576 dependencies = [ 577 "proc-macro2", 578 "quote", ··· 655 656 [[package]] 657 name = "windows-sys" 658 version = "0.59.0" 659 source = "registry+https://github.com/rust-lang/crates.io-index" 660 checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 661 dependencies = [ 662 + "windows-targets", 663 ] 664 665 [[package]] ··· 668 source = "registry+https://github.com/rust-lang/crates.io-index" 669 checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 670 dependencies = [ 671 + "windows_aarch64_gnullvm", 672 + "windows_aarch64_msvc", 673 + "windows_i686_gnu", 674 "windows_i686_gnullvm", 675 + "windows_i686_msvc", 676 + "windows_x86_64_gnu", 677 + "windows_x86_64_gnullvm", 678 + "windows_x86_64_msvc", 679 ] 680 681 [[package]] 682 name = "windows_aarch64_gnullvm" 683 version = "0.52.6" 684 source = "registry+https://github.com/rust-lang/crates.io-index" 685 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 686 687 [[package]] 688 name = "windows_aarch64_msvc" 689 version = "0.52.6" 690 source = "registry+https://github.com/rust-lang/crates.io-index" 691 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 692 693 [[package]] 694 name = "windows_i686_gnu" 695 version = "0.52.6" 696 source = "registry+https://github.com/rust-lang/crates.io-index" 697 checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" ··· 704 705 [[package]] 706 name = "windows_i686_msvc" 707 version = "0.52.6" 708 source = "registry+https://github.com/rust-lang/crates.io-index" 709 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 710 711 [[package]] 712 name = "windows_x86_64_gnu" 713 version = "0.52.6" 714 source = "registry+https://github.com/rust-lang/crates.io-index" 715 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 716 717 [[package]] 718 name = "windows_x86_64_gnullvm" 719 version = "0.52.6" 720 source = "registry+https://github.com/rust-lang/crates.io-index" 721 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 722 723 [[package]] 724 name = "windows_x86_64_msvc"
+1 -2
Cargo.toml
··· 1 [package] 2 name = "tsk-cli" 3 - version = "0.2.5" 4 edition = "2021" 5 publish = true 6 - license = "MIT" 7 license-file = "LICENSE" 8 description = "A command-line first, file-system based task manager" 9 repository = "https://codeberg.org/ngp/tsk"
··· 1 [package] 2 name = "tsk-cli" 3 + version = "0.2.6" 4 edition = "2021" 5 publish = true 6 license-file = "LICENSE" 7 description = "A command-line first, file-system based task manager" 8 repository = "https://codeberg.org/ngp/tsk"
+38 -3
src/main.rs
··· 13 use std::str::FromStr as _; 14 use std::{env::current_dir, io::Read}; 15 use task::ParsedLink; 16 - use workspace::{Id, TaskIdentifier, Workspace}; 17 18 //use smol; 19 //use iocraft::prelude::*; ··· 46 Init, 47 /// Creates a new task, automatically assigning it a unique identifider and persisting 48 Push { 49 /// Whether to open $EDITOR to edit the content of the task. The first line if the 50 /// resulting file will be the task's title. The body follows the title after two newlines, 51 /// similr to the format of a commit message. ··· 236 let var_name = match cli.command { 237 Commands::Init => command_init(dir), 238 Commands::Push { edit, body, title } => command_push(dir, edit, body, title), 239 Commands::List { all, count } => command_list(dir, all, count), 240 Commands::Swap => command_swap(dir), 241 Commands::Show { ··· 283 Workspace::init(dir) 284 } 285 286 - fn command_push(dir: PathBuf, edit: bool, body: Option<String>, title: Title) -> Result<()> { 287 - let workspace = Workspace::from_path(dir)?; 288 let mut title = if let Some(title) = title.title { 289 title 290 } else if let Some(title) = title.title_simple { ··· 309 } 310 let task = workspace.new_task(title, body)?; 311 workspace.handle_metadata(&task, None)?; 312 workspace.push_task(task) 313 } 314 315 fn command_list(dir: PathBuf, all: bool, count: usize) -> Result<()> {
··· 13 use std::str::FromStr as _; 14 use std::{env::current_dir, io::Read}; 15 use task::ParsedLink; 16 + use workspace::{Id, Task, TaskIdentifier, Workspace}; 17 18 //use smol; 19 //use iocraft::prelude::*; ··· 46 Init, 47 /// Creates a new task, automatically assigning it a unique identifider and persisting 48 Push { 49 + /// Whether to open $EDITOR to edit the content of the task. The first line if the 50 + /// resulting file will be the task's title. The body follows the title after two newlines, 51 + /// similr to the format of a commit message. 52 + #[arg(short = 'e', default_value_t = false)] 53 + edit: bool, 54 + 55 + /// The body of the task. It may be specified as either a string using quotes or the 56 + /// special character '-' to read from stdin. 57 + #[arg(short = 'b')] 58 + body: Option<String>, 59 + 60 + /// The title of the task as a raw string. It mus be proceeded by two dashes (--). 61 + #[command(flatten)] 62 + title: Title, 63 + }, 64 + /// Creates a new task just like `push`, but instead of putting it at the top of the stack, it 65 + /// puts it at the bottom 66 + Append { 67 /// Whether to open $EDITOR to edit the content of the task. The first line if the 68 /// resulting file will be the task's title. The body follows the title after two newlines, 69 /// similr to the format of a commit message. ··· 254 let var_name = match cli.command { 255 Commands::Init => command_init(dir), 256 Commands::Push { edit, body, title } => command_push(dir, edit, body, title), 257 + Commands::Append { edit, body, title } => command_append(dir, edit, body, title), 258 Commands::List { all, count } => command_list(dir, all, count), 259 Commands::Swap => command_swap(dir), 260 Commands::Show { ··· 302 Workspace::init(dir) 303 } 304 305 + fn create_task( 306 + workspace: &mut Workspace, 307 + edit: bool, 308 + body: Option<String>, 309 + title: Title, 310 + ) -> Result<Task> { 311 let mut title = if let Some(title) = title.title { 312 title 313 } else if let Some(title) = title.title_simple { ··· 332 } 333 let task = workspace.new_task(title, body)?; 334 workspace.handle_metadata(&task, None)?; 335 + Ok(task) 336 + } 337 + 338 + fn command_push(dir: PathBuf, edit: bool, body: Option<String>, title: Title) -> Result<()> { 339 + let mut workspace = Workspace::from_path(dir)?; 340 + let task = create_task(&mut workspace, edit, body, title)?; 341 workspace.push_task(task) 342 + } 343 + 344 + fn command_append(dir: PathBuf, edit: bool, body: Option<String>, title: Title) -> Result<()> { 345 + let mut workspace = Workspace::from_path(dir)?; 346 + let task = create_task(&mut workspace, edit, body, title)?; 347 + workspace.append_task(task) 348 } 349 350 fn command_list(dir: PathBuf, all: bool, count: usize) -> Result<()> {
+7
src/workspace.rs
··· 261 Ok(()) 262 } 263 264 pub fn swap_top(&self) -> Result<()> { 265 let mut stack = TaskStack::from_tskdir(&self.path)?; 266 stack.swap();
··· 261 Ok(()) 262 } 263 264 + pub fn append_task(&self, task: Task) -> Result<()> { 265 + let mut stack = TaskStack::from_tskdir(&self.path)?; 266 + stack.push_back(task.try_into()?); 267 + stack.save()?; 268 + Ok(()) 269 + } 270 + 271 pub fn swap_top(&self) -> Result<()> { 272 let mut stack = TaskStack::from_tskdir(&self.path)?; 273 stack.swap();