diff --git a/CHANGELOG.md b/CHANGELOG.md index b5764e1..bc74ab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,17 @@ All notable changes to this project will be documented in this file. -## [0.18.4] - 2023-06-14 +## [0.18.5] - 2023-06-17 + +### Documentation + +- Add note about env-substitute crate usage + +### Features + +- Added `select` flag to `explore` command as in `mds explore --select 'snippet | rust' --select syntaxes --select lib` + +## [0.18.4] - 2023-06-15 ### Documentation diff --git a/Cargo.lock b/Cargo.lock index 258e9cf..d005941 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1485,7 +1485,7 @@ dependencies = [ [[package]] name = "mds" -version = "0.18.4" +version = "0.18.5" dependencies = [ "anyhow", "async-recursion", diff --git a/Cargo.toml b/Cargo.toml index f78fefc..bbe1315 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mds" -version = "0.18.4" +version = "0.18.5" author = ["dj8yf0μl"] description = "A skim-based `*.md` explore and surf note-taking tool" repository = "https://github.com/dj8yfo/meudeus" diff --git a/USAGE.md b/USAGE.md index 79e0a2b..d1bd3ce 100644 --- a/USAGE.md +++ b/USAGE.md @@ -7,7 +7,7 @@ ``` ``` - meudeus v0.18.4 + meudeus v0.18.5 a skim shredder for plain-text papers Usage: mds [OPTIONS] diff --git a/src/commands/explore.rs b/src/commands/explore.rs index 2191a96..1781805 100644 --- a/src/commands/explore.rs +++ b/src/commands/explore.rs @@ -24,6 +24,7 @@ pub static GLOBAL_STACK: &str = "GLOBAL"; #[allow(clippy::too_many_arguments)] pub(crate) async fn exec( db: SqliteAsyncHandle, + selected_note: Option>, external_commands: ExternalCommands, surf_parsing: SurfParsing, md_static: MarkdownStatic, @@ -33,7 +34,17 @@ pub(crate) async fn exec( stack_bindings_map: keymap::stack::Bindings, explore_bindings_map: keymap::explore::Bindings, ) -> Result { - let mut list = db.lock().await.list(md_static, color_scheme).await?; + let mut list = match selected_note { + Some(notes) => { + let mut result = vec![]; + for note in notes { + let note = db.lock().await.get(¬e, md_static, color_scheme).await?; + result.push(note); + } + result + } + None => db.lock().await.list(md_static, color_scheme).await?, + }; let mut straight = true; let mut preview_type = PreviewType::default(); diff --git a/src/main.rs b/src/main.rs index b770b4a..ff81b33 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ #[macro_use] extern crate sql_builder; -use clap::ArgMatches; +use clap::{Arg, ArgAction, ArgMatches}; use colored::Colorize; use config::{color::Color, Open as OpenCfg}; @@ -57,8 +57,8 @@ fn load_theme(color: Color) -> Option<&'static Theme> { async fn main() { env_logger::init(); let cmd = clap::Command::new("mds") - .version("v0.18.4") - .about("meudeus v0.18.4\na skim shredder for plain-text papers") + .version("v0.18.5") + .about("meudeus v0.18.5\na skim shredder for plain-text papers") .bin_name("mds") .arg(clap::arg!(-c --color "whether color output should be forced")) .subcommand_required(true) @@ -120,6 +120,16 @@ async fn main() { ) .subcommand( clap::command!("explore") + .arg( + Arg::new("select") + .short('s') + .long("select") + .action(ArgAction::Append) + .value_name("NOTE_NAME_FULL") + .help( + "full name of note to start explore with (may be used multiple times)", + ), + ) .visible_alias("ex") .about("explore notes by (backlinks) , (links forward)"), ) @@ -196,8 +206,13 @@ async fn body(matches: &ArgMatches) -> anyhow::Result { .await } "explore" => { + let mut matches = matches.clone(); + let selected_note = matches + .remove_many::("select") + .map(|elems| elems.collect::>()); commands::explore::exec( db, + selected_note, config.external_commands, config.surf_parsing, md_static,