kitab

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | LICENSE

commit c41a9f35197a88d94e859fec7296ce819ee6fc2f
parent 5a96defc871111e0af66982aec8988b8fff45ede
Author: lash <dev@holbrook.no>
Date:   Wed, 21 Sep 2022 08:41:57 +0000

Hide new entry subcommand

Diffstat:
Msrc/main.rs | 46+++++++++++++++++++++++-----------------------
Msrc/meta.rs | 10++++++++++
2 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -61,7 +61,7 @@ fn args_setup() -> ArgMatches<'static> { let mut o_apply = ( SubCommand::with_name("apply") - .about("import information from file") + .about("Apply metadata on matching files") .version("0.0.1") ); o_apply = o_apply.arg( @@ -72,34 +72,34 @@ fn args_setup() -> ArgMatches<'static> { ); o = o.subcommand(o_apply); - let mut o_entry = ( - SubCommand::with_name("new") - .about("add metadata for file") - .version("0.0.1") - ); - o_entry = o_entry.arg(clap::Arg::with_name("validators") - .short("s") - .long("src") - .value_name("Add given validator engine") - .multiple(true) - .takes_value(true) - ); - - o_entry = o_entry.arg( - Arg::with_name("PATH") - .help("Path to operate on") - .required(true) - .index(1) - ); - o = o.subcommand(o_entry); +// let mut o_entry = ( +// SubCommand::with_name("new") +// .about("add metadata for file") +// .version("0.0.1") +// ); +// +// o_entry = o_entry.arg(clap::Arg::with_name("validators") +// .short("s") +// .long("src") +// .value_name("Add given validator engine") +// .multiple(true) +// .takes_value(true) +// ); +// +// o_entry = o_entry.arg( +// Arg::with_name("PATH") +// .help("Path to operate on") +// .required(true) +// .index(1) +// ); +// o = o.subcommand(o_entry); o.get_matches() } // commands // kitab import <file> - attempt in order import rdf, import spec - // kitab export <file> - export rdf/turtle - // kitab apply <path> - recursively +// kitab apply <path> - recursively fn resolve_directory(args: &ArgMatches) -> PathBuf { match BaseDirs::new() { diff --git a/src/meta.rs b/src/meta.rs @@ -332,7 +332,17 @@ impl MetaData { /// Applies the metadata as extended file attributes of the file in `filepath`. /// + /// Will always export: /// + /// * [title](DCMetaData::DC_XATTR_TITLE) + /// * [creator](DCMetaData::DC_XATTR_CREATOR) + /// * [category of file contents](DCMetaData::DC_XATTR_TYPE) + /// + /// Will export, if defined: + /// + /// * [language](DCMetaData::DC_XATTR_LANGUAGE) + /// * [MIME type of file](DCMetaData::DC_XATTR_MEDIATYPE) + /// * [A description of the subject matter of the file contents](DCMetaData::DC_XATTR_SUBJECT) pub fn to_xattr(&self, filepath: &path::Path) -> Result<(), std::io::Error> { let filename = filepath.file_name() .unwrap()