summaryrefslogtreecommitdiffstats
path: root/src/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 9098cfe..61399f7 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -3,21 +3,34 @@ use clap::Arg;
use clap::crate_authors;
use clap::crate_version;
-pub fn app<'a>() -> App<'a, 'a> {
+pub fn server_app<'a>() -> App<'a, 'a> {
+ App::new("fss")
+ .author(crate_authors!())
+ .version(crate_version!())
+ .about("Filesystemsearch")
+
+ .arg(self::common::arg_server_addr())
+ .arg(self::common::arg_server_port())
+}
+
+pub fn client_app<'a>() -> App<'a, 'a> {
App::new("fss")
.author(crate_authors!())
.version(crate_version!())
.about("Filesystemsearch")
+ .arg(self::common::arg_server_addr())
+ .arg(self::common::arg_server_port())
+
.subcommand(App::new("index")
.version(crate_version!())
.about("Index a file")
.arg(Arg::with_name("file")
.required(true)
- .multiple(true)
+ .multiple(false)
.value_name("FILE")
- .help("Index these files")
+ .help("Index this file")
)
)
@@ -33,4 +46,22 @@ pub fn app<'a>() -> App<'a, 'a> {
)
}
+mod common {
+ use clap::Arg;
+ pub fn arg_server_addr<'a, 'b>() -> Arg<'a, 'b> {
+ Arg::with_name("server_addr")
+ .required(false)
+ .multiple(false)
+ .value_name("ADDR")
+ .help("The address of the server")
+ }
+
+ pub fn arg_server_port<'a, 'b>() -> Arg<'a, 'b> {
+ Arg::with_name("server_port")
+ .required(false)
+ .multiple(false)
+ .value_name("PORT")
+ .help("The port of the server")
+ }
+}