You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
561 B
29 lines
561 B
//! Parse args
|
|
use super::*;
|
|
|
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
|
pub enum Operation
|
|
{
|
|
#[cfg(feature="server")] Server(server::Config),
|
|
#[cfg(feature="client")] Client(client::Config),
|
|
Help,
|
|
}
|
|
/// Name of the program
|
|
pub fn program() -> &'static str
|
|
{
|
|
lazy_static!{
|
|
static ref NAME: String = std::env::args().next().unwrap();
|
|
}
|
|
&NAME[..]
|
|
}
|
|
|
|
/// Attempt to parse the args
|
|
pub fn parse_args() -> impl Future<Output = Result<Operation, Error>>
|
|
{
|
|
parse::parse(std::env::args().skip(1))
|
|
}
|
|
|
|
mod parse;
|
|
mod error;
|
|
pub use error::Error;
|