Skip to content

Commit

Permalink
Fix command-line interface
Browse files Browse the repository at this point in the history
  • Loading branch information
katyo committed Jan 4, 2024
1 parent fc3743b commit d2d3497
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
17 changes: 11 additions & 6 deletions agent/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,30 @@ use argp::FromArgs;
#[cfg(feature = "tracing-subscriber")]
use tracing_subscriber::EnvFilter;

/// Tablet mode detection service
/// Tablet-mode assistance DBus session service.
#[derive(FromArgs, Debug)]
pub struct Args {
/// Log/trace filter
/// Log/trace filter.
#[cfg(feature = "tracing-subscriber")]
#[argp(option, short = 't', from_str_fn(Args::parse_env_filter))]
#[argp(
option,
short = 't',
arg_name = "filter",
from_str_fn(Args::parse_env_filter)
)]
pub trace: Option<EnvFilter>,

/// Log to stdout
/// Log to stdout.
#[cfg(feature = "stderr")]
#[argp(switch, short = 'l')]
pub log: bool,

/// Log to journald
/// Log to journald.
#[cfg(feature = "journal")]
#[argp(switch, short = 'j')]
pub journal: bool,

/// Show version and exit
/// Show version and exit.
#[argp(switch, short = 'v')]
pub version: bool,
}
Expand Down
23 changes: 14 additions & 9 deletions service/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,38 @@ use std::path::PathBuf;
#[cfg(feature = "tracing-subscriber")]
use tracing_subscriber::EnvFilter;

/// Tablet mode detection service
/// Tablet-mode assistance DBus system service.
#[derive(FromArgs, Debug)]
pub struct Args {
/// Path to config file
#[argp(option, short = 'c')]
/// Path to config file.
#[argp(option, short = 'c', arg_name = "path")]
pub config: Option<PathBuf>,

/// Run dbus service
/// Run dbus service.
#[argp(switch, short = 'd')]
pub dbus: bool,

/// Log/trace filter
/// Log/trace filter.
#[cfg(feature = "tracing-subscriber")]
#[argp(option, short = 't', from_str_fn(Args::parse_env_filter))]
#[argp(
option,
short = 't',
arg_name = "filter",
from_str_fn(Args::parse_env_filter)
)]
pub trace: Option<EnvFilter>,

/// Log to stdout
/// Log to stdout.
#[cfg(feature = "stderr")]
#[argp(switch, short = 'l')]
pub log: bool,

/// Log to journald
/// Log to journald.
#[cfg(feature = "journal")]
#[argp(switch, short = 'j')]
pub journal: bool,

/// Show version and exit
/// Show version and exit.
#[argp(switch, short = 'v')]
pub version: bool,
}
Expand Down

0 comments on commit d2d3497

Please sign in to comment.