feat: get config metadata

This will replace --get-name add provide both name and protocol in a
single json object
This commit is contained in:
Keivan-sf
2025-07-28 18:09:14 +03:30
parent 82a5942af7
commit 1dfb45412f
3 changed files with 24 additions and 12 deletions

View File

@@ -28,9 +28,9 @@ fn main() {
.value_parser(value_parser!(u16)),
)
.arg(
Arg::new("get_name")
.long("get-name")
.help("Only print the config name")
Arg::new("get_metadata")
.long("get-metadata")
.help("Only print config meta data")
.action(clap::ArgAction::SetTrue),
)
.get_matches();
@@ -38,10 +38,10 @@ fn main() {
let uri = matches.get_one::<String>("uri").unwrap();
let socksport = matches.get_one::<u16>("socksport").copied();
let httpport = matches.get_one::<u16>("httpport").copied();
let get_name = matches.get_flag("get_name");
let get_metadata = matches.get_flag("get_metadata");
if get_name {
print!("{}", parser::get_name(uri));
if get_metadata {
print!("{}", parser::get_metadata(uri));
return;
}