placed config into a function
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
//! # Gopherbridge - A Bridge to display content form different sources in gopher
|
|
||||||
//! This module lists all sub modules
|
|
||||||
45
src/main.rs
45
src/main.rs
@@ -1,9 +1,33 @@
|
|||||||
extern crate clap;
|
extern crate clap;
|
||||||
|
|
||||||
use clap::{App, Arg};
|
use clap::{App, Arg, ArgMatches};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiates an instance of the gopherbridge server and
|
||||||
|
* starts listening for connections on the given port.
|
||||||
|
*/
|
||||||
fn main() {
|
fn main() {
|
||||||
let matches = App::new("gopherbridge")
|
let matches = parse_command_line();
|
||||||
|
let pluginlist = matches.value_of("PLUGIN");
|
||||||
|
let port = matches.value_of("PORT");
|
||||||
|
|
||||||
|
match port {
|
||||||
|
None => println!("Default port 70 used"),
|
||||||
|
Some(p) => println!("Using port {}", p),
|
||||||
|
}
|
||||||
|
|
||||||
|
match pluginlist {
|
||||||
|
None => println!("No plugins given"),
|
||||||
|
Some(p) => println!("Loading the following plugins: {}", p),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the command line parameters passed to the server and creates the
|
||||||
|
* server lines
|
||||||
|
*/
|
||||||
|
fn parse_command_line<'a>() -> ArgMatches<'a> {
|
||||||
|
App::new("gopherbridge")
|
||||||
.version("0.1")
|
.version("0.1")
|
||||||
.author("jali@orca-central.de")
|
.author("jali@orca-central.de")
|
||||||
.about("a simple modular gopher server, that pushes converted web-content to a client")
|
.about("a simple modular gopher server, that pushes converted web-content to a client")
|
||||||
@@ -27,20 +51,7 @@ fn main() {
|
|||||||
.short("p")
|
.short("p")
|
||||||
.long("port")
|
.long("port")
|
||||||
.help("Specifies the port the server listens on. Default is 70")
|
.help("Specifies the port the server listens on. Default is 70")
|
||||||
.takes_value(false),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches()
|
||||||
|
|
||||||
let pluginlist = matches.value_of("PLUGIN");
|
|
||||||
let port = matches.value_of("PORT");
|
|
||||||
|
|
||||||
match port {
|
|
||||||
None => println!("Default port 70 used"),
|
|
||||||
Some(p) => println!("Using port {}", p),
|
|
||||||
}
|
|
||||||
|
|
||||||
match pluginlist {
|
|
||||||
None => println!("No plugins given"),
|
|
||||||
Some(p) => println!("Loading the following plugins: {}", p),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user