Advertise the --save flag more prominently

This commit is contained in:
Karcsesz 2024-02-14 21:14:43 +01:00
parent 4475917822
commit cc601fecde
6 changed files with 9 additions and 5 deletions

View file

@ -107,8 +107,8 @@ pub enum Command {
Init { Init {
/// Force creating a new database even if one exists already. WILL DELETE DATA! /// Force creating a new database even if one exists already. WILL DELETE DATA!
#[arg(long, short = 'f')] #[arg(long, short = 'f')]
force: bool force: bool,
} },
} }
#[derive(ValueEnum, Debug, Eq, PartialEq, Copy, Clone)] #[derive(ValueEnum, Debug, Eq, PartialEq, Copy, Clone)]

View file

@ -1,4 +1,4 @@
pub mod editor; pub mod editor;
pub mod fetch; pub mod fetch;
pub mod query;
pub mod init; pub mod init;
pub mod query;

View file

@ -2,6 +2,7 @@ use crate::args_parser::SaveSettings;
use crate::editor::open_in_editor::open_resource_in_editor; use crate::editor::open_in_editor::open_resource_in_editor;
use crate::schema::lookup_handler::LookupHandler; use crate::schema::lookup_handler::LookupHandler;
use std::path::PathBuf; use std::path::PathBuf;
use tracing::info;
pub fn editor(database_path: PathBuf, save_settings: SaveSettings, resource: String) { pub fn editor(database_path: PathBuf, save_settings: SaveSettings, resource: String) {
let resources = LookupHandler::load(&database_path).unwrap(); let resources = LookupHandler::load(&database_path).unwrap();
@ -13,5 +14,7 @@ pub fn editor(database_path: PathBuf, save_settings: SaveSettings, resource: Str
let mut resources = resources.into_inner(); let mut resources = resources.into_inner();
resources.0[index] = resource; resources.0[index] = resource;
resources.save(database_path).unwrap(); resources.save(database_path).unwrap();
} else {
info!("To save edits, run this command with the -s flag")
} }
} }

View file

@ -64,5 +64,6 @@ pub fn fetch(
for resource in new_resources { for resource in new_resources {
println!("{resource}") println!("{resource}")
} }
info!("To save changes, rerun this command with the -s flag set")
} }
} }

View file

@ -1,11 +1,11 @@
use crate::args_parser::Command; use crate::args_parser::Command;
use crate::editor::commands::editor::editor; use crate::editor::commands::editor::editor;
use crate::editor::commands::init::init;
use crate::editor::try_reload_server::reload; use crate::editor::try_reload_server::reload;
use clap::Parser; use clap::Parser;
use editor::commands::fetch::fetch; use editor::commands::fetch::fetch;
use editor::commands::query::query; use editor::commands::query::query;
use tracing_subscriber::util::SubscriberInitExt; use tracing_subscriber::util::SubscriberInitExt;
use crate::editor::commands::init::init;
mod args_parser; mod args_parser;
#[cfg(feature = "editor")] #[cfg(feature = "editor")]