diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2020-10-02 00:48:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-02 00:48:16 +0000 |
commit | 39d7677f90d49af1b836f060787d8b357f36942d (patch) | |
tree | f8c76796852c7307c7e73ed26961a18d5e2cfb7c /src/args.rs | |
parent | Merge pull request #384 from svenstaro/dependabot/cargo/chrono-0.4.19 (diff) | |
parent | more feedback (diff) | |
download | miniserve-39d7677f90d49af1b836f060787d8b357f36942d.tar.gz miniserve-39d7677f90d49af1b836f060787d8b357f36942d.zip |
Merge pull request #380 from ahti/master
client-side color-scheme handling
Diffstat (limited to 'src/args.rs')
-rw-r--r-- | src/args.rs | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/args.rs b/src/args.rs index 25a3503..dc160d0 100644 --- a/src/args.rs +++ b/src/args.rs @@ -5,7 +5,7 @@ use structopt::StructOpt; use crate::auth; use crate::errors::ContextualError; -use crate::themes; +use crate::renderer; /// Possible characters for random routes const ROUTE_ALPHABET: [char; 16] = [ @@ -71,11 +71,21 @@ struct CLIArgs { #[structopt( short = "c", long = "color-scheme", - default_value = "Squirrel", - possible_values = &themes::ColorScheme::variants(), + default_value = "squirrel", + possible_values = &renderer::THEME_SLUGS, case_insensitive = true, )] - color_scheme: themes::ColorScheme, + color_scheme: String, + + /// Default color scheme + #[structopt( + short = "d", + long = "color-scheme-dark", + default_value = "archlinux", + possible_values = &renderer::THEME_SLUGS, + case_insensitive = true, + )] + color_scheme_dark: String, /// Enable QR code display #[structopt(short = "q", long = "qrcode")] @@ -175,11 +185,13 @@ pub fn parse_args() -> crate::MiniserveConfig { None }; - // Generate some random route for the favicon so that it is very unlikely to conflict with a - // real file. + // Generate some random routes for the favicon and css so that they are very unlikely to conflict with + // real files. let favicon_route = nanoid::nanoid!(10, &ROUTE_ALPHABET); + let css_route = nanoid::nanoid!(10, &ROUTE_ALPHABET); let default_color_scheme = args.color_scheme; + let default_color_scheme_dark = args.color_scheme_dark; let path_explicitly_chosen = args.path.is_some(); @@ -198,7 +210,9 @@ pub fn parse_args() -> crate::MiniserveConfig { no_symlinks: args.no_symlinks, random_route, favicon_route, + css_route, default_color_scheme, + default_color_scheme_dark, index: args.index, overwrite_files: args.overwrite_files, show_qrcode: args.qrcode, |