aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-12-11 21:49:23 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-12-11 21:51:56 -0800
commit962c1b8c946e1730e2172984328d051e7b0f72de (patch)
tree3a2e4640bcf99c5c87fc7cc17f31016327d039a3 /src
parentb82f57d1ef9bc1cf8f55753df94f75e83d16a75b (diff)
downloadgeniza-962c1b8c946e1730e2172984328d051e7b0f72de.tar.gz
geniza-962c1b8c946e1730e2172984328d051e7b0f72de.zip
flush out geniza command modes
Diffstat (limited to 'src')
-rw-r--r--src/bin/geniza.rs60
1 files changed, 52 insertions, 8 deletions
diff --git a/src/bin/geniza.rs b/src/bin/geniza.rs
index ee91d4f..794d3ed 100644
--- a/src/bin/geniza.rs
+++ b/src/bin/geniza.rs
@@ -10,7 +10,7 @@ extern crate geniza;
// TODO: more careful import
use geniza::*;
use std::path::Path;
-use clap::{App, SubCommand, Arg};
+use clap::{App, SubCommand};
fn run() -> Result<()> {
env_logger::init().unwrap();
@@ -20,15 +20,26 @@ fn run() -> Result<()> {
.subcommand(
SubCommand::with_name("clone")
.about("Finds and downloads a dat archive from the network into a given folder")
- .arg_from_usage("<address> 'dat address (public key) to fetch'"),
+ .arg_from_usage("<address> 'dat address (public key) to fetch'")
+ .arg_from_usage("[dir] 'directory to clone into'")
+ .arg_from_usage("--full 'pull and save complete history (not just latest version)'"),
)
.subcommand(
SubCommand::with_name("init")
.about("Creates a data archive in the current directory")
+ .arg_from_usage("[dir] 'init somewhere other than current directory'"),
+ )
+ .subcommand(
+ SubCommand::with_name("status")
+ .about("Displays current status of archive and checkout")
+ )
+ .subcommand(
+ SubCommand::with_name("log")
+ .about("Displays version history of the archive")
)
.subcommand(
SubCommand::with_name("checkout")
- .about("Copies (or overwrites) files from dat archive into current folder")
+ .about("Copies (or overwrites) files from dat archive")
.arg_from_usage("<path> 'relative path to checkout'"),
)
.subcommand(
@@ -41,31 +52,64 @@ fn run() -> Result<()> {
.about("Removes a path from the current dat archive, and from disk (danger!)")
.arg_from_usage("<path> 'file to delete from dat archive'"),
)
+ .subcommand(
+ SubCommand::with_name("ls")
+ .about("Lists contents of the archive")
+ .arg_from_usage("[path] 'path to display'")
+ .arg_from_usage("--recursive 'show directory recursively'"),
+ )
+ .subcommand(
+ SubCommand::with_name("seed")
+ .about("Uploads indefinately to any peer")
+ )
+ .subcommand(
+ SubCommand::with_name("pull")
+ .about("Pulls highest known version from all possible peers")
+ .arg_from_usage("--forever 'continues to search for updates forever'"),
+ )
.get_matches();
-
match matches.subcommand() {
("clone", Some(subm)) => {
let dat_key = subm.value_of("dat_key").unwrap();
- let key_bytes = parse_dat_address(&dat_key)?;
+ let _key_bytes = parse_dat_address(&dat_key)?;
unimplemented!();
//let dir = Path::new(subm.value_of("dat-dir").unwrap());
//let mut metadata = SleepDirRegister::create(&dir, "metadata")?;
//node_simple_clone(host_port, &key_bytes, &mut metadata, false)?;
}
("init", Some(subm)) => {
+ let _dir = Path::new(subm.value_of("dir").unwrap());
+ unimplemented!();
+ }
+ ("status", Some(_subm)) => {
+ unimplemented!();
+ }
+ ("log", Some(_subm)) => {
unimplemented!();
}
("checkout", Some(subm)) => {
- let path = Path::new(subm.value_of("path").unwrap());
+ let _path = Path::new(subm.value_of("path").unwrap());
unimplemented!();
}
("add", Some(subm)) => {
- let path = Path::new(subm.value_of("path").unwrap());
+ let _path = Path::new(subm.value_of("path").unwrap());
unimplemented!();
}
("rm", Some(subm)) => {
- let path = Path::new(subm.value_of("path").unwrap());
+ let _path = Path::new(subm.value_of("path").unwrap());
+ unimplemented!();
+ }
+ ("ls", Some(subm)) => {
+ let _path = Path::new(subm.value_of("path").unwrap());
+ unimplemented!();
+ }
+ ("seed", Some(subm)) => {
+ let _path = Path::new(subm.value_of("path").unwrap());
+ unimplemented!();
+ }
+ ("pull", Some(subm)) => {
+ let _path = Path::new(subm.value_of("path").unwrap());
unimplemented!();
}
_ => {