diff options
author | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-04-03 18:07:33 +0000 |
---|---|---|
committer | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-04-03 18:07:33 +0000 |
commit | 0304ea92390c06ccbbd7d29a88ecedc9718d72c2 (patch) | |
tree | 670c3b12843187e042ca3981960b0cf56230985e /src/args.rs | |
parent | Added light theme (diff) | |
download | miniserve-0304ea92390c06ccbbd7d29a88ecedc9718d72c2.tar.gz miniserve-0304ea92390c06ccbbd7d29a88ecedc9718d72c2.zip |
Added CLI argument to set default theme
Diffstat (limited to 'src/args.rs')
-rw-r--r-- | src/args.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/args.rs b/src/args.rs index 4f0dbf7..bcee0bc 100644 --- a/src/args.rs +++ b/src/args.rs @@ -3,6 +3,7 @@ use std::path::PathBuf; use structopt::StructOpt; use crate::auth; +use crate::themes; /// Possible characters for random routes const ROUTE_ALPHABET: [char; 16] = [ @@ -47,6 +48,18 @@ struct CLIArgs { /// Do not follow symbolic links #[structopt(short = "P", long = "no-symlinks")] no_symlinks: bool, + + /// Default color scheme + #[structopt( + short = "c", + long = "color-scheme", + default_value = "Squirrel", + raw( + possible_values = "&themes::ColorScheme::variants()", + case_insensitive = "true", + ) + )] + color_scheme: themes::ColorScheme, } /// Checks wether an interface is valid, i.e. it can be parsed into an IP address @@ -89,6 +102,8 @@ pub fn parse_args() -> crate::MiniserveConfig { None }; + let default_color_scheme = args.color_scheme; + let path_explicitly_chosen = args.path.is_some(); crate::MiniserveConfig { @@ -100,5 +115,6 @@ pub fn parse_args() -> crate::MiniserveConfig { path_explicitly_chosen, no_symlinks: args.no_symlinks, random_route, + default_color_scheme, } } |