minor internal documentation changes

This commit is contained in:
aaron-jack-manning 2022-08-25 20:55:28 +10:00
parent 0f542eb054
commit fccb2c0696
4 changed files with 20 additions and 11 deletions

2
Cargo.lock generated
View File

@ -843,7 +843,7 @@ dependencies = [
[[package]] [[package]]
name = "toru" name = "toru"
version = "0.1.4" version = "0.2.0"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",

View File

@ -55,15 +55,13 @@ OPTIONS:
-V, --version Print version information -V, --version Print version information
SUBCOMMANDS: SUBCOMMANDS:
clean Deletes all discarded tasks
complete Mark a task as complete complete Mark a task as complete
config For making changes to global configuration config For making changes to global configuration
delete Delete a task completely delete Delete a task (move file to trash)
discard Discard a task without deleting the underlying file
edit Edit a task directly edit Edit a task directly
git Run Git commands at the root of the vault git Run Git commands at the root of the vault
gitignore Adds the recommended .gitignore file to the vault gitignore Adds the recommended .gitignore file to the vault
list Lists tasks according to the specified ordering and filters list Lists tasks according to the specified fields, ordering and filters
new Create a new task new Create a new task
stats For statistics about the state of your vault stats For statistics about the state of your vault
svn Run Subversion commands at the root of the vault svn Run Subversion commands at the root of the vault

View File

@ -14,8 +14,6 @@ use tasks::Id;
use std::path; use std::path;
#[derive(clap::Parser, Debug)] #[derive(clap::Parser, Debug)]
struct Args { struct Args {
#[clap(subcommand)] #[clap(subcommand)]
@ -103,32 +101,45 @@ enum Command {
#[derive(clap::StructOpt, Debug, PartialEq, Eq)] #[derive(clap::StructOpt, Debug, PartialEq, Eq)]
pub struct ListOptions { pub struct ListOptions {
/// Include name column.
#[clap(long)] #[clap(long)]
name : bool, name : bool,
/// Include tracked time column.
#[clap(long)] #[clap(long)]
tracked : bool, tracked : bool,
/// Include due date column.
#[clap(long)] #[clap(long)]
due : bool, due : bool,
/// Include tags column.
#[clap(long)] #[clap(long)]
tags : bool, tags : bool,
/// Include priority column.
#[clap(long)] #[clap(long)]
priority : bool, priority : bool,
/// Include status column.
#[clap(long)] #[clap(long)]
status : bool, status : bool,
/// Include created date column.
#[clap(long)] #[clap(long)]
created : bool, created : bool,
/// The field to sort by.
#[clap(long, value_enum, default_value_t=SortBy::Id)] #[clap(long, value_enum, default_value_t=SortBy::Id)]
sort_by : SortBy, sort_by : SortBy,
/// Sort ascending on descending.
#[clap(long, value_enum, default_value_t=SortType::Asc)] #[clap(long, value_enum, default_value_t=SortType::Asc)]
sort_type : SortType, sort_type : SortType,
/// Only include tasks created before a certain date.
#[clap(long)] #[clap(long)]
before : Option<chrono::NaiveDateTime>, before : Option<chrono::NaiveDateTime>,
/// Only include tasks created after a certain date.
#[clap(long)] #[clap(long)]
after : Option<chrono::NaiveDateTime>, after : Option<chrono::NaiveDateTime>,
/// Only include tasks due within a certain number of days.
#[clap(long)] #[clap(long)]
due_in : Option<u16>, due_in : Option<u16>,
/// Include completed tasks in the list.
#[clap(long)] #[clap(long)]
include_complete : bool, include_completed : bool,
} }
impl Default for ListOptions { impl Default for ListOptions {
@ -146,7 +157,7 @@ impl Default for ListOptions {
before : None, before : None,
after : None, after : None,
due_in : None, due_in : None,
include_complete : false, include_completed : false,
} }
} }
} }

View File

@ -446,7 +446,7 @@ pub fn list(options : super::ListOptions, vault_folder : &path::Path) -> Result<
before : None, before : None,
after : None, after : None,
due_in : None, due_in : None,
include_complete : false, include_completed : false,
}; };
// If the arguments are not given, use a set of defaults. // If the arguments are not given, use a set of defaults.
@ -484,7 +484,7 @@ pub fn list(options : super::ListOptions, vault_folder : &path::Path) -> Result<
} }
})); }));
} }
if !options.include_complete { if !options.include_completed {
tasks = Box::new(tasks.filter(|t| t.data.completed.is_none())); tasks = Box::new(tasks.filter(|t| t.data.completed.is_none()));
} }