mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-17 08:09:52 +00:00
stash: make log messages lowercase
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I45a9055b6bc3bfbf2179627470d0cedd6a6a6964
This commit is contained in:
parent
b71801f7df
commit
61ff65e9e8
1 changed files with 20 additions and 20 deletions
40
src/main.rs
40
src/main.rs
|
|
@ -45,7 +45,7 @@ struct Cli {
|
||||||
preview_width: u32,
|
preview_width: u32,
|
||||||
|
|
||||||
/// Path to the `SQLite` clipboard database file.
|
/// Path to the `SQLite` clipboard database file.
|
||||||
#[arg(long)]
|
#[arg(long, env = "STASH_DB_PATH")]
|
||||||
db_path: Option<PathBuf>,
|
db_path: Option<PathBuf>,
|
||||||
|
|
||||||
/// Application names to exclude from clipboard history
|
/// Application names to exclude from clipboard history
|
||||||
|
|
@ -183,7 +183,7 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
#[cfg(not(feature = "use-toplevel"))]
|
#[cfg(not(feature = "use-toplevel"))]
|
||||||
&[],
|
&[],
|
||||||
),
|
),
|
||||||
"Failed to store entry",
|
"failed to store entry",
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
Some(Command::List { format }) => {
|
Some(Command::List { format }) => {
|
||||||
|
|
@ -191,7 +191,7 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
Some("tsv") => {
|
Some("tsv") => {
|
||||||
report_error(
|
report_error(
|
||||||
db.list(io::stdout(), cli.preview_width),
|
db.list(io::stdout(), cli.preview_width),
|
||||||
"Failed to list entries",
|
"failed to list entries",
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
Some("json") => {
|
Some("json") => {
|
||||||
|
|
@ -200,23 +200,23 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
println!("{json}");
|
println!("{json}");
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::error!("Failed to list entries as JSON: {e}");
|
log::error!("failed to list entries as JSON: {e}");
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(other) => {
|
Some(other) => {
|
||||||
log::error!("Unsupported format: {other}");
|
log::error!("unsupported format: {other}");
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
if std::io::stdout().is_terminal() {
|
if std::io::stdout().is_terminal() {
|
||||||
report_error(
|
report_error(
|
||||||
db.list_tui(cli.preview_width),
|
db.list_tui(cli.preview_width),
|
||||||
"Failed to list entries in TUI",
|
"failed to list entries in TUI",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
report_error(
|
report_error(
|
||||||
db.list(io::stdout(), cli.preview_width),
|
db.list(io::stdout(), cli.preview_width),
|
||||||
"Failed to list entries",
|
"failed to list entries",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -225,7 +225,7 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
Some(Command::Decode { input }) => {
|
Some(Command::Decode { input }) => {
|
||||||
report_error(
|
report_error(
|
||||||
db.decode(io::stdin(), io::stdout(), input),
|
db.decode(io::stdin(), io::stdout(), input),
|
||||||
"Failed to decode entry",
|
"failed to decode entry",
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
Some(Command::Delete { arg, r#type, ask }) => {
|
Some(Command::Delete { arg, r#type, ask }) => {
|
||||||
|
|
@ -238,7 +238,7 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
|
||||||
if !should_proceed {
|
if !should_proceed {
|
||||||
log::info!("Aborted by user.");
|
log::info!("aborted by user.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if should_proceed {
|
if should_proceed {
|
||||||
|
|
@ -251,13 +251,13 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
"Failed to delete entry by id",
|
"Failed to delete entry by id",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
log::error!("Argument is not a valid id");
|
log::error!("argument is not a valid id");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(Some(s), Some("query")) => {
|
(Some(s), Some("query")) => {
|
||||||
report_error(
|
report_error(
|
||||||
db.query_delete(&s),
|
db.query_delete(&s),
|
||||||
"Failed to delete entry by query",
|
"failed to delete entry by query",
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
(Some(s), None) => {
|
(Some(s), None) => {
|
||||||
|
|
@ -265,23 +265,23 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
report_error(
|
report_error(
|
||||||
db.delete(Cursor::new(format!("{id}\n"))),
|
db.delete(Cursor::new(format!("{id}\n"))),
|
||||||
"Failed to delete entry by id",
|
"failed to delete entry by id",
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
report_error(
|
report_error(
|
||||||
db.query_delete(&s),
|
db.query_delete(&s),
|
||||||
"Failed to delete entry by query",
|
"failed to delete entry by query",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(None, _) => {
|
(None, _) => {
|
||||||
report_error(
|
report_error(
|
||||||
db.delete(io::stdin()),
|
db.delete(io::stdin()),
|
||||||
"Failed to delete entry from stdin",
|
"failed to delete entry from stdin",
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
(_, Some(_)) => {
|
(_, Some(_)) => {
|
||||||
log::error!("Unknown type for --type. Use \"id\" or \"query\".");
|
log::error!("unknown type for --type. Use \"id\" or \"query\".");
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -296,11 +296,11 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
.prompt()
|
.prompt()
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
if !should_proceed {
|
if !should_proceed {
|
||||||
log::info!("Aborted by user.");
|
log::info!("wipe command aborted by user.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if should_proceed {
|
if should_proceed {
|
||||||
report_error(db.wipe(), "Failed to wipe database");
|
report_error(db.wipe(), "failed to wipe database");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -315,7 +315,7 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
.prompt()
|
.prompt()
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
if !should_proceed {
|
if !should_proceed {
|
||||||
log::info!("Aborted by user.");
|
log::info!("import command aborted by user.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if should_proceed {
|
if should_proceed {
|
||||||
|
|
@ -325,11 +325,11 @@ fn main() -> color_eyre::eyre::Result<()> {
|
||||||
if let Err(e) =
|
if let Err(e) =
|
||||||
ImportCommand::import_tsv(&db, io::stdin(), cli.max_items)
|
ImportCommand::import_tsv(&db, io::stdin(), cli.max_items)
|
||||||
{
|
{
|
||||||
log::error!("Failed to import TSV: {e}");
|
log::error!("failed to import TSV: {e}");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
log::error!("Unsupported import format: {format}");
|
log::error!("unsupported import format: {format}");
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue