mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-17 13:17:55 +08:00
improve imap and mbox arg/handler
This commit is contained in:
+11
-11
@@ -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)])]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user