diff --git a/src/cli/cli.rs b/src/cli/cli.rs index 6ed8e07173e94ba9dca83f75b92360ff0609a2f2..65dd5703fafacfa1d6483af9a25da6166a3c721c 100644 --- a/src/cli/cli.rs +++ b/src/cli/cli.rs @@ -1,21 +1,29 @@ pub const USAGE: &'static str = " -Static file swerver and api mocker for local development. For full documentation, -visit https://swerve.louiscap.io. +Static file swerver and api mocker for local development. +For full documentation, visit https://swerve.louiscap.io. Usage: swerve [options] -Options: - -h, --help Display this text - -q, --quiet Don't print anything to stdout - --no-index Don't serve index.html files for directory paths - -d=<path>, --dir=<path> Root directory; defaults to cwd - -p=<port>, --port=<port> Port; defaults to 8200 - -a=<addr>, --address=<addr> Address to bind to (e.g. 10.0.0.15); defaults to localhost - -c=<path>, --config=<path> Path to the .swerve config file - -t=<num>, --threads=<num> Number of worker threads to use for serving files; defaults to 32 - -u, --upload Support file uploads to '/upload' - -U=<path>, --upload-path=<path> Set the url path that will accept file uploads. Implies -u if not present +General Options: + -h, --help Display this text + -q, --quiet Don't print anything to stdout + --license Show the GPL v3 license text + +Web Server Options: + --no-index Don't serve index.html files for directory paths + -d=<path>, --dir=<path> Root directory; defaults to cwd + -p=<port>, --port=<port> Port; defaults to 8200 + -a=<addr>, --address=<addr> Address to bind to (e.g. 10.0.0.15); defaults to localhost + -c=<path>, --config=<path> Path to the .swerve config file + -t=<num>, --threads=<num> Number of worker threads to use for serving files; defaults to 32 + +Data Handling Options + -u, --upload Support file uploads to '/upload' + -U=<path>, --upload-path=<path> Set the url path that will accept file uploads. Implies 'upload' flag if not present + +Swerve Copyright (C) 2018 Louis Capitanchik +Licensed under GPLv3+ "; #[derive(Debug, Deserialize, Clone)] @@ -30,4 +38,5 @@ pub struct Args { pub flag_no_index: bool, pub flag_upload: bool, pub flag_upload_path: Option<String>, + pub flag_license: bool, } \ No newline at end of file diff --git a/src/cli/gpl.rs b/src/cli/gpl.rs new file mode 100644 index 0000000000000000000000000000000000000000..f99aa70ae9da5571e7a61174d1bd96c087f85f2f --- /dev/null +++ b/src/cli/gpl.rs @@ -0,0 +1,8 @@ +use std::process; + +const LICENSE: &'static str = include_str!("../../COPYING"); + +pub fn show_license_and_exit() { + println!("{}", LICENSE); + process::exit(0); +} \ No newline at end of file diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 3f293ea53beffc270f205de17388c2dd2332dbce..4993a2f81a9f290dccf6376a9afbe69b8fad9a1e 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -1,5 +1,7 @@ mod cli; mod config_file; +pub mod gpl; + pub use self::cli::{Args, USAGE}; pub use self::config_file::{HandlerMethod, SwerveConfig}; \ No newline at end of file