mirror of
https://github.com/TECHNOFAB11/tmux-copyrat.git
synced 2026-02-03 01:45:11 +01:00
refactor: rename ParseError -> Error
This commit is contained in:
parent
7d1bb69c6f
commit
5d9ea6f7f8
8 changed files with 21 additions and 19 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use clap::{ArgEnum, Parser};
|
||||
|
||||
use crate::{
|
||||
error::ParseError,
|
||||
error::Error,
|
||||
textbuf::{alphabet, regexes},
|
||||
ui, Result,
|
||||
};
|
||||
|
|
@ -80,7 +80,7 @@ pub enum HintStyleArg {
|
|||
/// Try to parse a `&str` into a tuple of `char`s.
|
||||
fn parse_chars(src: &str) -> Result<(char, char)> {
|
||||
if src.chars().count() != 2 {
|
||||
return Err(ParseError::ExpectedSurroundingPair);
|
||||
return Err(Error::ExpectedSurroundingPair);
|
||||
}
|
||||
|
||||
let chars: Vec<char> = src.chars().collect();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use std::fmt;
|
|||
use clap::{ArgEnum, Parser};
|
||||
|
||||
use super::basic;
|
||||
use crate::{error::ParseError, textbuf::alphabet, tmux, ui, Result};
|
||||
use crate::{error::Error, 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
|
||||
|
|
@ -66,7 +66,7 @@ impl ConfigExt {
|
|||
"@copyrat-capture-region" => {
|
||||
let case_insensitive = true;
|
||||
config_ext.capture_region = CaptureRegion::from_str(value, case_insensitive)
|
||||
.map_err(ParseError::ExpectedEnumVariant)?
|
||||
.map_err(Error::ExpectedEnumVariant)?
|
||||
}
|
||||
"@copyrat-alphabet" => {
|
||||
inner.alphabet = alphabet::parse_alphabet(value)?;
|
||||
|
|
@ -92,13 +92,13 @@ impl ConfigExt {
|
|||
"@copyrat-hint-alignment" => {
|
||||
let case_insensitive = true;
|
||||
inner.hint_alignment = ui::HintAlignment::from_str(value, case_insensitive)
|
||||
.map_err(ParseError::ExpectedEnumVariant)?
|
||||
.map_err(Error::ExpectedEnumVariant)?
|
||||
}
|
||||
"@copyrat-hint-style" => {
|
||||
let case_insensitive = true;
|
||||
inner.hint_style = Some(
|
||||
basic::HintStyleArg::from_str(value, case_insensitive)
|
||||
.map_err(ParseError::ExpectedEnumVariant)?,
|
||||
.map_err(Error::ExpectedEnumVariant)?,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue