improve imap and mbox arg/handler

This commit is contained in:
Clément DOUIN
2021-09-16 16:43:41 +02:00
parent 248240f52d
commit bc5f9045ce
15 changed files with 198 additions and 118 deletions
+11 -11
View File
@@ -1,21 +1,12 @@
//! Module related to completion arguments.
//!
//! This module provides subcommands and an argument matcher for the completion command.
//! This module provides subcommands and an argument matcher related to completion.
use anyhow::Result;
use clap::{self, App, Arg, ArgMatches, Shell, SubCommand};
use log::debug;
/// Subcommands related to the completion generation.
pub fn subcmds<'a>() -> Vec<App<'a, 'a>> {
vec![SubCommand::with_name("completion")
.about("Generates the completion script for the given shell")
.args(&[Arg::with_name("shell")
.possible_values(&Shell::variants()[..])
.required(true)])]
}
/// Enumeration of all possible completion matches.
/// Enumeration of all possible matches.
pub enum Match<'a> {
/// Generate completion script for the given shell slice.
Generate(&'a str),
@@ -32,3 +23,12 @@ pub fn matches<'a>(m: &'a ArgMatches) -> Result<Option<Match<'a>>> {
Ok(None)
}
/// Completion subcommands.
pub fn subcmds<'a>() -> Vec<App<'a, 'a>> {
vec![SubCommand::with_name("completion")
.about("Generates the completion script for the given shell")
.args(&[Arg::with_name("shell")
.possible_values(&Shell::variants()[..])
.required(true)])]
}