mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-16 06:37:23 +08:00
add options to generate completions (#1103)
* add options to generate completions use clap-complete crate to generate completions scripts: easytier-core --generate fish > ~/.config/fish/completions/easytier-core.fish --------- Co-authored-by: Sijie.Sun <sunsijie@buaa.edu.cn>
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::io;
|
||||
|
||||
use clap::Command;
|
||||
use clap_complete::Generator;
|
||||
|
||||
mod arch;
|
||||
mod gateway;
|
||||
mod instance;
|
||||
@@ -21,3 +26,7 @@ mod tests;
|
||||
|
||||
pub const VERSION: &str = common::constants::EASYTIER_VERSION;
|
||||
rust_i18n::i18n!("locales", fallback = "en");
|
||||
|
||||
pub fn print_completions<G: Generator>(generator: G, cmd: &mut Command, bin_name:&str) {
|
||||
clap_complete::generate(generator, cmd, bin_name, &mut io::stdout());
|
||||
}
|
||||
Reference in New Issue
Block a user