Skip to content

Commit

Permalink
feat: maximum displayed characters from config
Browse files Browse the repository at this point in the history
  • Loading branch information
Rational-Curiosity committed May 24, 2024
1 parent ad3bb33 commit 4631a26
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ server_endpoint = "/run/user/<user-id>/clipcat/grpc.sock"

# The default finder to invoke when no "--finder=<finder>" option provided.
finder = "rofi"
# Maximum displayed characters
preview_length = 130

[log]
# Emit log message to a log file.
Expand Down
12 changes: 12 additions & 0 deletions clipcat-menu/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ pub struct Cli {
#[arg(long = "log-level", env = "CLIPCAT_MENU_LOG_LEVEL", help = "Specify a log level")]
log_level: Option<tracing::Level>,

#[arg(
long = "preview-length",
env = "CLIPCAT_MENU_PREVIEW_LENGTH",
help = "Specify the preview length"
)]
preview_length: Option<usize>,

#[arg(
long = "config",
short = 'c',
Expand Down Expand Up @@ -104,6 +111,7 @@ impl Cli {
let Self {
commands,
log_level,
preview_length,
config_file,
finder,
rofi_config,
Expand Down Expand Up @@ -148,6 +156,10 @@ impl Cli {

config.log.registry();

if let Some(preview_length) = preview_length {
config.preview_length = preview_length;
}

let finder =
build_finder(finder, rofi_config, dmenu_config, custom_finder_config, &mut config);
let fut = async move {
Expand Down

0 comments on commit 4631a26

Please sign in to comment.