added test code

This commit is contained in:
2019-06-02 00:55:12 +02:00
parent e4e12a659f
commit e81cda8b73
5 changed files with 178 additions and 19 deletions

View File

@@ -1,3 +1,2 @@
//! # Gopherbridge - A Bridge to display content form different sources in gopher
//! This module lists all sub modules
mod settings;

View File

@@ -1,16 +0,0 @@
//! # Settings
//! Implements a settings module
//!
//! ## Examples
//!
use config;
/// Read and access the configuration for the server
/// class uses the config module to read data from a
/// toml file or the command line.
pub struct Settings {
debug: bool,
listenPort: i32,
bridges: Vec<String>
}

View File

@@ -1,4 +1,41 @@
extern crate clap;
use clap::{Arg, App};
fn main() {
println!("Hello, world!");
let matches = App::new("gopherbridge")
.version("0.1")
.author("jali@orca-central.de")
.about("a simple modular gopher server, that pushes converted web-content to a client")
.arg(Arg::with_name("FORGROUND")
.short("f")
.long("foreground")
.help("Keeps the service in the foreground")
.takes_value(false))
.arg(Arg::with_name("PLUGIN")
.short("l")
.long("plugins")
.value_name("PLUGINLIST")
.takes_value(true)
.index(1))
.arg(Arg::with_name("PORT")
.short("p")
.long("port")
.help("Specifies the port the server listens on. Default is 70")
.takes_value(false))
.get_matches();
let pluginlist = matches.value_of("PLUGIN");
let port = matches.value_of("PORT");
match pluginlist {
None => println!("No plugin list"),
Some => println!("Selected Plugins: {}",Some(pluginlist));
}
match port {
None => println!("Running on default port"),
Some => println!("Port is {}",Some(port))
}
println!("{}",port);
}