mirror of
https://github.com/TECHNOFAB11/tmux-copyrat.git
synced 2025-12-12 16:10:07 +01:00
refactor: publicly expose error::Error
This commit is contained in:
parent
3bebad0da6
commit
d2eb8f0e16
7 changed files with 9 additions and 9 deletions
|
|
@ -1,9 +1,8 @@
|
||||||
use clap::{ArgEnum, Parser};
|
use clap::{ArgEnum, Parser};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
error::Error,
|
|
||||||
textbuf::{alphabet, regexes},
|
textbuf::{alphabet, regexes},
|
||||||
ui, Result,
|
ui, Error, Result,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Main configuration, parsed from command line.
|
/// Main configuration, parsed from command line.
|
||||||
|
|
@ -70,7 +69,7 @@ pub struct Config {
|
||||||
|
|
||||||
/// Type introduced due to parsing limitation,
|
/// Type introduced due to parsing limitation,
|
||||||
/// as we cannot directly parse tuples into ui::HintStyle.
|
/// as we cannot directly parse tuples into ui::HintStyle.
|
||||||
#[derive(Debug, Clone, ArgEnum, Parser)]
|
#[derive(Debug, Clone, ArgEnum)]
|
||||||
pub enum HintStyleArg {
|
pub enum HintStyleArg {
|
||||||
Bold,
|
Bold,
|
||||||
Italic,
|
Italic,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use std::fmt;
|
||||||
use clap::{ArgEnum, Parser};
|
use clap::{ArgEnum, Parser};
|
||||||
|
|
||||||
use super::basic;
|
use super::basic;
|
||||||
use crate::{error::Error, textbuf::alphabet, tmux, ui, Result};
|
use crate::{textbuf::alphabet, tmux, ui, Error, Result};
|
||||||
|
|
||||||
/// Extended configuration for handling Tmux-specific configuration (options
|
/// Extended configuration for handling Tmux-specific configuration (options
|
||||||
/// and outputs). This is only used by `tmux-copyrat` and parsed from command
|
/// and outputs). This is only used by `tmux-copyrat` and parsed from command
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ pub mod textbuf;
|
||||||
pub mod tmux;
|
pub mod tmux;
|
||||||
pub mod ui;
|
pub mod ui;
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, error::Error>;
|
pub use error::Error;
|
||||||
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
||||||
/// Run copyrat on an input string `buffer`, configured by `Opt`.
|
/// Run copyrat on an input string `buffer`, configured by `Opt`.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::{error::Error, Result};
|
use crate::{Error, Result};
|
||||||
|
|
||||||
/// Catalog of available alphabets.
|
/// Catalog of available alphabets.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
//!
|
//!
|
||||||
//! All patterns must have one capture group. The first group is used.
|
//! All patterns must have one capture group. The first group is used.
|
||||||
|
|
||||||
use crate::{error::Error, Result};
|
use crate::{Error, Result};
|
||||||
|
|
||||||
pub(super) const EXCLUDE_PATTERNS: [(&str, &str); 1] =
|
pub(super) const EXCLUDE_PATTERNS: [(&str, &str); 1] =
|
||||||
[("ansi_colors", r"[[:cntrl:]]\[([0-9]{1,2};)?([0-9]{1,2})?m")];
|
[("ansi_colors", r"[[:cntrl:]]\[([0-9]{1,2};)?([0-9]{1,2})?m")];
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use std::str::FromStr;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
use crate::config::extended::CaptureRegion;
|
use crate::config::extended::CaptureRegion;
|
||||||
use crate::{error::Error, Result};
|
use crate::{Error, Result};
|
||||||
|
|
||||||
/// Represents a simplified Tmux Pane, only holding the properties needed in
|
/// Represents a simplified Tmux Pane, only holding the properties needed in
|
||||||
/// this crate.
|
/// this crate.
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use termion::color;
|
use termion::color;
|
||||||
|
|
||||||
use crate::{error::Error, Result};
|
use crate::{Error, Result};
|
||||||
|
|
||||||
pub fn parse_color(src: &str) -> Result<Box<dyn color::Color>> {
|
pub fn parse_color(src: &str) -> Result<Box<dyn color::Color>> {
|
||||||
match src {
|
match src {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue