refactor: config names

This commit is contained in:
graelo 2021-03-21 08:51:45 +01:00
parent d558c81183
commit 0ee29303c6
6 changed files with 23 additions and 26 deletions

View file

@ -12,7 +12,7 @@ use crate::{
/// Main configuration, parsed from command line.
#[derive(Clap, Debug)]
#[clap(author, about, version)]
pub struct CliOpt {
pub struct Config {
/// Alphabet to draw hints from.
///
/// Possible values are "{A}", "{A}-homerow", "{A}-left-hand",
@ -108,7 +108,7 @@ fn parse_chars(src: &str) -> Result<(char, char), error::ParseError> {
Ok((chars[0], chars[1]))
}
impl CliOpt {
impl Config {
/// Try parsing provided options, and update self with the valid values.
pub fn merge_map(
&mut self,

View file

@ -1,5 +1,2 @@
mod basic;
mod bridge;
pub use self::basic::{CliOpt, HintStyleArg};
pub use self::bridge::BridgeOpt;
pub mod basic;
pub mod tmux_bridge;

View file

@ -2,14 +2,14 @@ use clap::Clap;
use std::collections::HashMap;
use std::str::FromStr;
use super::CliOpt;
use super::basic;
use crate::comm::tmux;
use crate::error;
/// Main configuration, parsed from command line.
#[derive(Clap, Debug)]
#[clap(author, about, version)]
pub struct BridgeOpt {
pub struct Config {
/// Don't read options from Tmux.
///
/// By default, options formatted like `copyrat-*` are read from tmux.
@ -40,10 +40,10 @@ pub struct BridgeOpt {
// Include CLI Options
#[clap(flatten)]
pub cli_options: CliOpt,
pub cli_options: basic::Config,
}
impl BridgeOpt {
impl Config {
/// Try parsing provided options, and update self with the valid values.
/// Unknown options are simply ignored.
pub fn merge_map(