time entry representation change, and basic statistics
This commit is contained in:
21
src/main.rs
21
src/main.rs
@@ -4,6 +4,7 @@ mod vault;
|
||||
mod error;
|
||||
mod tasks;
|
||||
mod state;
|
||||
mod stats;
|
||||
mod config;
|
||||
mod colour;
|
||||
|
||||
@@ -82,6 +83,9 @@ enum Command {
|
||||
#[clap(short, default_value_t=0)]
|
||||
minutes : u16,
|
||||
},
|
||||
/// For statistics about the state of your vault.
|
||||
#[clap(subcommand)]
|
||||
Stats(StatsCommand),
|
||||
/// For making changes to global configuration.
|
||||
#[clap(subcommand)]
|
||||
Config(ConfigCommand),
|
||||
@@ -94,6 +98,15 @@ enum Command {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
#[derive(clap::Subcommand, Debug, PartialEq, Eq)]
|
||||
enum StatsCommand {
|
||||
Tracked {
|
||||
#[clap(short, long, default_value_t=7)]
|
||||
days : u16,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(clap::Subcommand, Debug, PartialEq, Eq)]
|
||||
enum ConfigCommand {
|
||||
/// For checking or changing default text editor command.
|
||||
@@ -251,6 +264,14 @@ fn program() -> Result<(), error::Error> {
|
||||
task.data.time_entries.push(entry);
|
||||
task.save()?;
|
||||
},
|
||||
Stats(command) => {
|
||||
use StatsCommand::*;
|
||||
match command {
|
||||
Tracked { days } => {
|
||||
stats::time_per_tag(days, vault_folder)?;
|
||||
}
|
||||
}
|
||||
},
|
||||
Discard { id_or_name } => {
|
||||
let id = state.name_or_id_to_id(&id_or_name)?;
|
||||
let mut task = tasks::Task::load(id, vault_folder, false)?;
|
||||
|
||||
Reference in New Issue
Block a user