mirror of
https://git.alemi.dev/memo-cli.git
synced 2024-11-14 05:39:19 +01:00
include git hash into version
This commit is contained in:
parent
4e49696dab
commit
581aca2fb1
2 changed files with 15 additions and 4 deletions
|
@ -11,6 +11,8 @@ edition = "2021"
|
|||
[dependencies]
|
||||
regex = "1"
|
||||
chrono = "0.4.19"
|
||||
git-version = "0.3.5" # ughh just for git hash
|
||||
const_format = "0.2.22" # ughh just for git hash
|
||||
libnotify = "1.0.3"
|
||||
clap = { version = "3.1.6", features = ["derive"] }
|
||||
rusqlite = { version="0.27.0", features=["chrono"] }
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -4,11 +4,18 @@ mod utils;
|
|||
use chrono::{DateTime, Utc, Local};
|
||||
use clap::{Parser, Subcommand};
|
||||
use regex::Regex;
|
||||
pub use storage::{open_sqlite_storage, Memo, MemoStorage};
|
||||
use storage::{open_sqlite_storage, Memo, MemoStorage};
|
||||
use utils::{parse_human_duration, HumanDisplay};
|
||||
use git_version::git_version;
|
||||
use const_format::concatcp;
|
||||
|
||||
const GIT_VERSION: &str = git_version!();
|
||||
const PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
const VERSION: &str = concatcp!(PKG_VERSION, "-", GIT_VERSION);
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(author, version, about, long_about = None)]
|
||||
#[clap(author, about, long_about = None)]
|
||||
#[clap(version = VERSION)]
|
||||
#[clap(disable_colored_help = true)]
|
||||
#[clap(subcommand_required = false)]
|
||||
#[clap(disable_help_subcommand = true)]
|
||||
|
@ -20,11 +27,12 @@ struct Cli {
|
|||
#[clap(long, help = "show completed tasks")]
|
||||
old: bool,
|
||||
#[clap(short, long, help = "location for database file")]
|
||||
db_path: Option<String>,
|
||||
path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Commands {
|
||||
/// create a new memo
|
||||
#[clap(trailing_var_arg = true)]
|
||||
New {
|
||||
#[clap(multiple_values = true)]
|
||||
|
@ -34,6 +42,7 @@ enum Commands {
|
|||
#[clap(short, long, help = "due time relative to now")]
|
||||
due: Option<String>, // TODO allow to pass date
|
||||
},
|
||||
/// mark existing memo as done
|
||||
Done {
|
||||
search: String,
|
||||
#[clap(long, help = "delete more than one task if matched")]
|
||||
|
@ -46,7 +55,7 @@ fn main() {
|
|||
let home_path = std::env!("HOME").to_string();
|
||||
let mut db_path: String = home_path + "/.local/share/memo-cli.db";
|
||||
|
||||
if let Some(db) = args.db_path {
|
||||
if let Some(db) = args.path {
|
||||
db_path = db;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue