mirror of https://github.com/Tim-Paik/srv.git
v1.0.0-rc.8 Update clap to 3.0.0, ready to release
This commit is contained in:
parent
02b6c26874
commit
2c1cdc5720
File diff suppressed because it is too large
Load Diff
|
@ -11,7 +11,7 @@ actix-http = "2.2"
|
|||
actix-web = {version = "3.3", features = ["rustls"]}
|
||||
actix-web-httpauth = "0.5"
|
||||
chrono = "0.4"
|
||||
clap = {version = "3.0.0-beta.5", features = ["wrap_help", "color"]}
|
||||
clap = {version = "3.0.0", features = ["wrap_help", "color", "cargo"]}
|
||||
env_logger = "0.9"
|
||||
lazy_static = "1.4"
|
||||
log = "0.4"
|
||||
|
|
49
src/main.rs
49
src/main.rs
|
@ -381,34 +381,31 @@ async fn main() -> std::io::Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
};
|
||||
let matches = clap::App::new(crate_name!())
|
||||
.version(crate_version!())
|
||||
.author(crate_authors!())
|
||||
.about(crate_description!())
|
||||
.arg(Arg::new("noindex").long("noindex").about("Disable automatic index page generation"))
|
||||
.arg(Arg::new("compress").short('c').long("compress").about("Enable streaming compression (Content-length/segment download will be disabled)"))
|
||||
.arg(Arg::new("nocache").long("nocache").about("Disable HTTP cache"))
|
||||
.arg(Arg::new("nocolor").long("nocolor").about("Disable cli colors"))
|
||||
.arg(Arg::new("cors").long("cors").takes_value(true).min_values(0).max_values(1).about("Enable CORS [with custom value]"))
|
||||
.arg(Arg::new("spa").long("spa").about("Enable Single-Page Application mode (always serve /index.html when the file is not found)"))
|
||||
.arg(Arg::new("dotfiles").short('d').long("dotfiles").about("Show dotfiles"))
|
||||
.arg(Arg::new("open").short('o').long("open").about("Open the page in the default browser"))
|
||||
.arg(Arg::new("quiet").short('q').long("quiet").about("Disable access log output"))
|
||||
.arg(Arg::new("quietall").long("quietall").about("Disable all output"))
|
||||
.arg(Arg::new("ROOT").default_value(".").validator(check_does_dir_exits).about("Root directory"))
|
||||
.arg(Arg::new("address").short('a').long("address").default_value("0.0.0.0").takes_value(true).validator(check_is_ip_addr).about("IP address to serve on"))
|
||||
.arg(Arg::new("port").short('p').long("port").default_value("8000").takes_value(true).validator(check_is_port_num).about("Port to serve on"))
|
||||
.arg(Arg::new("auth").long("auth").takes_value(true).validator(check_is_auth).about("HTTP Auth (username:password)"))
|
||||
.arg(Arg::new("cert").long("cert").takes_value(true).validator(check_does_file_exits).about("Path of TLS/SSL public key (certificate)"))
|
||||
.arg(Arg::new("key").long("key").takes_value(true).validator(check_does_file_exits).about("Path of TLS/SSL private key"))
|
||||
let matches = app_from_crate!()
|
||||
.arg(Arg::new("noindex").long("noindex").help("Disable automatic index page generation"))
|
||||
.arg(Arg::new("compress").short('c').long("compress").help("Enable streaming compression (Content-length/segment download will be disabled)"))
|
||||
.arg(Arg::new("nocache").long("nocache").help("Disable HTTP cache"))
|
||||
.arg(Arg::new("nocolor").long("nocolor").help("Disable cli colors"))
|
||||
.arg(Arg::new("cors").long("cors").takes_value(true).min_values(0).max_values(1).help("Enable CORS [with custom value]"))
|
||||
.arg(Arg::new("spa").long("spa").help("Enable Single-Page Application mode (always serve /index.html when the file is not found)"))
|
||||
.arg(Arg::new("dotfiles").short('d').long("dotfiles").help("Show dotfiles"))
|
||||
.arg(Arg::new("open").short('o').long("open").help("Open the page in the default browser"))
|
||||
.arg(Arg::new("quiet").short('q').long("quiet").help("Disable access log output"))
|
||||
.arg(Arg::new("quietall").long("quietall").help("Disable all output"))
|
||||
.arg(Arg::new("ROOT").default_value(".").validator(check_does_dir_exits).help("Root directory"))
|
||||
.arg(Arg::new("address").short('a').long("address").default_value("0.0.0.0").takes_value(true).validator(check_is_ip_addr).help("IP address to serve on"))
|
||||
.arg(Arg::new("port").short('p').long("port").default_value("8000").takes_value(true).validator(check_is_port_num).help("Port to serve on"))
|
||||
.arg(Arg::new("auth").long("auth").takes_value(true).validator(check_is_auth).help("HTTP Auth (username:password)"))
|
||||
.arg(Arg::new("cert").long("cert").takes_value(true).validator(check_does_file_exits).help("Path of TLS/SSL public key (certificate)"))
|
||||
.arg(Arg::new("key").long("key").takes_value(true).validator(check_does_file_exits).help("Path of TLS/SSL private key"))
|
||||
.subcommand(clap::App::new("doc")
|
||||
.about("Open cargo doc via local server (Need cargo installation)")
|
||||
.arg(Arg::new("nocolor").long("nocolor").about("Disable cli colors"))
|
||||
.arg(Arg::new("noopen").long("noopen").about("Do not open the page in the default browser"))
|
||||
.arg(Arg::new("log").long("log").about("Enable access log output [default: disabled]"))
|
||||
.arg(Arg::new("quietall").long("quietall").about("Disable all output"))
|
||||
.arg(Arg::new("address").short('a').long("address").default_value("0.0.0.0").takes_value(true).validator(check_is_ip_addr).about("IP address to serve on"))
|
||||
.arg(Arg::new("port").short('p').long("port").default_value("8000").takes_value(true).validator(check_is_port_num).about("Port to serve on"))
|
||||
.arg(Arg::new("nocolor").long("nocolor").help("Disable cli colors"))
|
||||
.arg(Arg::new("noopen").long("noopen").help("Do not open the page in the default browser"))
|
||||
.arg(Arg::new("log").long("log").help("Enable access log output [default: disabled]"))
|
||||
.arg(Arg::new("quietall").long("quietall").help("Disable all output"))
|
||||
.arg(Arg::new("address").short('a').long("address").default_value("0.0.0.0").takes_value(true).validator(check_is_ip_addr).help("IP address to serve on"))
|
||||
.arg(Arg::new("port").short('p').long("port").default_value("8000").takes_value(true).validator(check_is_port_num).help("Port to serve on"))
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
|
|
Loading…
Reference in New Issue