added missing bracket in args.rs

This commit is contained in:
Daniel Szabo 2022-10-25 12:51:59 +03:00
parent dc2c7094a8
commit e258bcc2bd
No known key found for this signature in database
GPG key ID: D4D95121C054CFBC

View file

@ -1,9 +1,9 @@
use clap::Parser;
use lazy_static::lazy_static;
use std::convert::Infallible; use std::convert::Infallible;
use std::fmt; use std::fmt;
use std::net::IpAddr; use std::net::IpAddr;
use std::str::FromStr; use std::str::FromStr;
use clap::Parser;
use lazy_static::lazy_static;
lazy_static! { lazy_static! {
pub static ref ARGS: Args = Args::parse(); pub static ref ARGS: Args = Args::parse();
@ -12,61 +12,61 @@ lazy_static! {
#[derive(Parser, Debug, Clone)] #[derive(Parser, Debug, Clone)]
#[clap(author, version, about, long_about = None)] #[clap(author, version, about, long_about = None)]
pub struct Args { pub struct Args {
#[clap(long, env="MICROBIN_AUTH_USERNAME")] #[clap(long, env = "MICROBIN_AUTH_USERNAME")]
pub auth_username: Option<String>, pub auth_username: Option<String>,
#[clap(long, env="MICROBIN_AUTH_PASSWORD")] #[clap(long, env = "MICROBIN_AUTH_PASSWORD")]
pub auth_password: Option<String>, pub auth_password: Option<String>,
#[clap(long, env="MICROBIN_EDITABLE")] #[clap(long, env = "MICROBIN_EDITABLE")]
pub editable: bool, pub editable: bool,
#[clap(long, env="MICROBIN_FOOTER_TEXT")] #[clap(long, env = "MICROBIN_FOOTER_TEXT")]
pub footer_text: Option<String>, pub footer_text: Option<String>,
#[clap(long, env="MICROBIN_HIDE_FOOTER")] #[clap(long, env = "MICROBIN_HIDE_FOOTER")]
pub hide_footer: bool, pub hide_footer: bool,
#[clap(long, env="MICROBIN_HIDE_HEADER")] #[clap(long, env = "MICROBIN_HIDE_HEADER")]
pub hide_header: bool, pub hide_header: bool,
#[clap(long, env="MICROBIN_HIDE_LOGO")] #[clap(long, env = "MICROBIN_HIDE_LOGO")]
pub hide_logo: bool, pub hide_logo: bool,
#[clap(long, env="MICROBIN_NO_LISTING")] #[clap(long, env = "MICROBIN_NO_LISTING")]
pub no_listing: bool, pub no_listing: bool,
#[clap(long, env="MICROBIN_HIGHLIGHTSYNTAX")] #[clap(long, env = "MICROBIN_HIGHLIGHTSYNTAX")]
pub highlightsyntax: bool, pub highlightsyntax: bool,
#[clap(short, long, env="MICROBIN_PORT", default_value_t = 8080)] #[clap(short, long, env = "MICROBIN_PORT", default_value_t = 8080)]
pub port: u16, pub port: u16,
#[clap(short, long, env="MICROBIN_BIND", default_value_t = IpAddr::from([0, 0, 0, 0]))] #[clap(short, long, env="MICROBIN_BIND", default_value_t = IpAddr::from([0, 0, 0, 0]))]
pub bind: IpAddr, pub bind: IpAddr,
#[clap(long, env="MICROBIN_PRIVATE")] #[clap(long, env = "MICROBIN_PRIVATE")]
pub private: bool, pub private: bool,
#[clap(long, env="MICROBIN_PURE_HTML")] #[clap(long, env = "MICROBIN_PURE_HTML")]
pub pure_html: bool, pub pure_html: bool,
#[clap(long, env="MICROBIN_PUBLIC_PATH", default_value_t = PublicUrl(String::from("")))] #[clap(long, env="MICROBIN_PUBLIC_PATH", default_value_t = PublicUrl(String::from("")))]
pub public_path: PublicUrl, pub public_path: PublicUrl,
#[clap(long, env="MICROBIN_READONLY")] #[clap(long, env = "MICROBIN_READONLY")]
pub readonly: bool, pub readonly: bool,
#[clap(long, env="MICROBIN_TITLE")] #[clap(long, env = "MICROBIN_TITLE")]
pub title: Option<String>, pub title: Option<String>,
#[clap(short, long, env="MICROBIN_THREADS", default_value_t = 1)] #[clap(short, long, env = "MICROBIN_THREADS", default_value_t = 1)]
pub threads: u8, pub threads: u8,
#[clap(long, env="MICROBIN_WIDE")] #[clap(long, env = "MICROBIN_WIDE")]
pub wide: bool, pub wide: bool,
#[clap(short, long, env="MICROBIN_NO_FILE_UPLOAD")] #[clap(short, long, env = "MICROBIN_NO_FILE_UPLOAD")]
pub no_file_upload: bool, pub no_file_upload: bool,
} }
@ -86,3 +86,4 @@ impl FromStr for PublicUrl {
let uri = s.strip_suffix('/').unwrap_or(s).to_owned(); let uri = s.strip_suffix('/').unwrap_or(s).to_owned();
Ok(PublicUrl(uri)) Ok(PublicUrl(uri))
} }
}