mirror of
https://github.com/TECHNOFAB11/tmux-copyrat.git
synced 2026-02-02 09:25:11 +01:00
refactor: use custom Result
This commit is contained in:
parent
077d16311e
commit
7d1bb69c6f
8 changed files with 34 additions and 33 deletions
|
|
@ -3,7 +3,7 @@ use clap::{ArgEnum, Parser};
|
|||
use crate::{
|
||||
error::ParseError,
|
||||
textbuf::{alphabet, regexes},
|
||||
ui,
|
||||
ui, Result,
|
||||
};
|
||||
|
||||
/// Main configuration, parsed from command line.
|
||||
|
|
@ -78,7 +78,7 @@ pub enum HintStyleArg {
|
|||
}
|
||||
|
||||
/// Try to parse a `&str` into a tuple of `char`s.
|
||||
fn parse_chars(src: &str) -> Result<(char, char), ParseError> {
|
||||
fn parse_chars(src: &str) -> Result<(char, char)> {
|
||||
if src.chars().count() != 2 {
|
||||
return Err(ParseError::ExpectedSurroundingPair);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use std::fmt;
|
|||
use clap::{ArgEnum, Parser};
|
||||
|
||||
use super::basic;
|
||||
use crate::{error::ParseError, textbuf::alphabet, tmux, ui};
|
||||
use crate::{error::ParseError, textbuf::alphabet, tmux, ui, Result};
|
||||
|
||||
/// Extended configuration for handling Tmux-specific configuration (options
|
||||
/// and outputs). This is only used by `tmux-copyrat` and parsed from command
|
||||
|
|
@ -52,7 +52,7 @@ pub struct ConfigExt {
|
|||
}
|
||||
|
||||
impl ConfigExt {
|
||||
pub fn initialize() -> Result<ConfigExt, ParseError> {
|
||||
pub fn initialize() -> Result<ConfigExt> {
|
||||
let mut config_ext = ConfigExt::parse();
|
||||
|
||||
if !config_ext.ignore_tmux_options {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue