diff options
| author | Xavier Del Campo <xavi92psx@gmail.com> | 2018-12-31 00:28:46 +0100 |
|---|---|---|
| committer | Xavier Del Campo <xavi92psx@gmail.com> | 2018-12-31 00:28:46 +0100 |
| commit | 42f2476aeebc5eb5a9366a6a366c9678eba6eb1b (patch) | |
| tree | 2098f4cdd976edae82d841f56298a6030512a792 /src/cmdline.rs | |
| parent | b47361f283777f266970f9c082782ebac6c04aef (diff) | |
Some more work, but it still does not compile
Diffstat (limited to 'src/cmdline.rs')
| -rw-r--r-- | src/cmdline.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/cmdline.rs b/src/cmdline.rs index 6405301..d4828b2 100644 --- a/src/cmdline.rs +++ b/src/cmdline.rs @@ -17,7 +17,12 @@ pub const PORT_NAME_ARG : &'static str = "--port-name"; /// This parameter disables sending any information /// coming from the console to stdout. pub const DISABLE_OUTPUT_ARG : &'static str = "--disable-output"; -pub const BAUDRATE_ARG : &'static str = "--baudrate"; + +/// This parameter allows defining a specific baud rate, +pub const BAUDRATE_ARG : &'static str = "--baud-rate"; + +/// This parameter allows using a TCP connection +/// against a GUI front-end. pub const TCP_ARG : &'static str = "--tcp"; const CMD_LINE_ARGS : [CmdLineArg; 4] = @@ -40,7 +45,7 @@ const CMD_LINE_ARGS : [CmdLineArg; 4] = arg_str : BAUDRATE_ARG, param_str : Some("[BAUDRATE]"), is_required : false, - explanation : "Sets serial port baudrate. Defaults to 4800bps" + explanation : "Sets serial port baudrate. Defaults to 115200 bps" }, CmdLineArg { @@ -68,6 +73,10 @@ fn show_help() { } } +/// This function creates a Hashmap instance +/// that relates all command line arguments +/// against its parameters. For example: +/// ["--baud-rate", "4800"], ["--disable-output", ""] pub fn process_arguments() -> Option<HashMap<String, String>> { if env::args_os().count() <= 1 { @@ -79,7 +88,7 @@ pub fn process_arguments() -> Option<HashMap<String, String>> { // This enum defines a finite-state machine that // will be used to determine what type of data is - // being retrieved + // being retrieved from command line arguments. enum ExpectedParameter { ParameterOption, |
