manager: acme plugin: auto-complete available DNS challenge types
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
e857f1fae8
commit
ea1458923e
@ -343,6 +343,7 @@ pub fn plugin_cli() -> CommandLineInterface {
|
|||||||
"add",
|
"add",
|
||||||
CliCommand::new(&API_METHOD_ADD_PLUGIN)
|
CliCommand::new(&API_METHOD_ADD_PLUGIN)
|
||||||
.arg_param(&["type", "id"])
|
.arg_param(&["type", "id"])
|
||||||
|
.completion_cb("api", crate::config::acme::complete_acme_api_challenge_type)
|
||||||
.completion_cb("type", crate::config::acme::complete_acme_plugin_type),
|
.completion_cb("type", crate::config::acme::complete_acme_plugin_type),
|
||||||
)
|
)
|
||||||
.insert(
|
.insert(
|
||||||
|
@ -161,3 +161,14 @@ pub fn complete_acme_plugin_type(_arg: &str, _param: &HashMap<String, String>) -
|
|||||||
//"http".to_string(), // makes currently not realyl sense to create or the like
|
//"http".to_string(), // makes currently not realyl sense to create or the like
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn complete_acme_api_challenge_type(_arg: &str, param: &HashMap<String, String>) -> Vec<String> {
|
||||||
|
if param.get("type") == Some(&"dns".to_string()) {
|
||||||
|
match load_dns_challenge_schema() {
|
||||||
|
Ok(schema) => schema.into_iter().map(|s| s.id).collect(),
|
||||||
|
Err(_) => Vec::new(),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user