feat: add clap feature

This commit is contained in:
2026-10-03 20:16:12 +02:00
parent cb9af02a9c
commit aa12ffe8ff
4 changed files with 123 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ use crate::api::errors::LibnotifyError;
use super::libnotify::*;
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
/// Notification urgency level. Refer to [libnotify docs](https://gnome.pages.gitlab.gnome.org/libnotify/enum.Urgency.html) for more info
pub enum Urgency {
/// Low urgency. Used for unimportant notifications
@@ -46,6 +47,7 @@ pub enum HintValue {
/// Notification timeout, until close
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
pub enum Timeout {
#[allow(missing_docs)]
Default,

View File

@@ -1,12 +1,17 @@
//! This crate exposes two modules:
//!
//! # Api
//! # Crate structure
//! ## Api
//! This module contains a basic wrapper for libnotify calls. It just translates data types, etc,
//! so usage is basically the same as libnotify.
//!
//! # Wrappers
//! ## Wrappers
//! This module is a higher level abstraction over api. Recommended to use over api.
//!
//! # Features
//!
//! - clap – enables [clap] support for `Urgency` and `Timeout` enums
//!
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]