Compare commits
1 Commits
main
...
f2700b4329
| Author | SHA1 | Date | |
|---|---|---|---|
| f2700b4329 |
@@ -1,12 +1,9 @@
|
|||||||
name: Build
|
name: Build
|
||||||
on:
|
on:
|
||||||
release:
|
- release:
|
||||||
types:
|
types: [published]
|
||||||
- published
|
- pull_request:
|
||||||
pull_request:
|
types: [opened, edited]
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- edited
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -16,5 +13,11 @@ jobs:
|
|||||||
- uses: dtolnay/rust-toolchain@stable
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test
|
run: cargo test
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
depends-on: test
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo build --release --target x86_64-unknown-linux-gnu
|
run: cargo build --release --target x86_64-unknown-linux-gnu
|
||||||
|
|||||||
8
TODO.md
8
TODO.md
@@ -1,6 +1,8 @@
|
|||||||
- [ ] Obsidian properties
|
- [ ] Obsidian properties
|
||||||
- [x] config for default properties
|
- [ ] encoding in YAML (using Serde)
|
||||||
|
- [ ] config for default properties
|
||||||
- [ ] formatting for properties such as dates
|
- [ ] formatting for properties such as dates
|
||||||
- [ ] figure out what frontmatter obsidian uses
|
- [x] update rendering to use comrak (it's been update)
|
||||||
- [ ] generate title
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ pub struct Args {
|
|||||||
/// show current config file
|
/// show current config file
|
||||||
#[arg(short = 'C', long)]
|
#[arg(short = 'C', long)]
|
||||||
pub current_config: bool,
|
pub current_config: bool,
|
||||||
// generate config file (output to stdout)
|
|
||||||
#[arg(long, default_value_t = true)]
|
|
||||||
pub gen_config: bool,
|
|
||||||
|
|
||||||
/// view a specific date's file (YYYY-MM-DD)
|
/// view a specific date's file (YYYY-MM-DD)
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ extern crate serde_json;
|
|||||||
use figment::providers::{Env, Format, Json, Serialized};
|
use figment::providers::{Env, Format, Json, Serialized};
|
||||||
use figment::Figment;
|
use figment::Figment;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::env::var;
|
use std::env::var;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
@@ -14,9 +13,7 @@ use std::path::PathBuf;
|
|||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub editor: String,
|
pub editor: String,
|
||||||
pub sections: Vec<String>,
|
pub sections: Vec<String>,
|
||||||
pub scratch_section: String,
|
|
||||||
pub notes_dir: String,
|
pub notes_dir: String,
|
||||||
pub frontmatter: HashMap<String, String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
@@ -24,9 +21,7 @@ impl Default for Config {
|
|||||||
Config {
|
Config {
|
||||||
editor: "nano".into(),
|
editor: "nano".into(),
|
||||||
sections: vec!["Daily".into(), "Weekly".into(), "Monthly".into()],
|
sections: vec!["Daily".into(), "Weekly".into(), "Monthly".into()],
|
||||||
scratch_section: "".into(),
|
|
||||||
notes_dir: "~/Notes".into(),
|
notes_dir: "~/Notes".into(),
|
||||||
frontmatter: HashMap::new(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/main.rs
13
src/main.rs
@@ -10,14 +10,14 @@ use clap::Parser;
|
|||||||
use cli::Args;
|
use cli::Args;
|
||||||
use comrak::options::{Extension, Parse};
|
use comrak::options::{Extension, Parse};
|
||||||
use comrak::{format_commonmark, Arena, Options};
|
use comrak::{format_commonmark, Arena, Options};
|
||||||
use config::{Config, ConfigError};
|
use config::Config;
|
||||||
use log;
|
use log;
|
||||||
use logging::get_logging_level;
|
use logging::get_logging_level;
|
||||||
use resolve_path::PathResolveExt;
|
use resolve_path::PathResolveExt;
|
||||||
use simple_logger::init_with_level;
|
use simple_logger::init_with_level;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process::{exit, Command};
|
use std::process::Command;
|
||||||
use todo::{File as TodoFile, TaskGroup};
|
use todo::{File as TodoFile, TaskGroup};
|
||||||
|
|
||||||
use crate::file::{extract_sections, process_doc_tree};
|
use crate::file::{extract_sections, process_doc_tree};
|
||||||
@@ -51,15 +51,6 @@ fn main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.gen_config {
|
|
||||||
let buf = match serde_json::to_string_pretty(&Config::default()) {
|
|
||||||
Ok(text) => text,
|
|
||||||
_ => panic!("Could not generate config text"),
|
|
||||||
};
|
|
||||||
println!("{}", buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set witch config file to load
|
// set witch config file to load
|
||||||
let cfg_file = match args.config {
|
let cfg_file = match args.config {
|
||||||
Some(file) => file,
|
Some(file) => file,
|
||||||
|
|||||||
Reference in New Issue
Block a user