pijul 0.3.0

A patch-based distributed version control system, easy to use and fast. Command-line interface.
#[macro_use]
extern crate clap;
#[macro_use]
extern crate log;
extern crate env_logger;
extern crate libpijul;
extern crate getch;
extern crate toml;
extern crate regex;
extern crate hyper;
extern crate hyper_rustls;
extern crate chrono;
extern crate thrussh;
extern crate rustc_serialize;
extern crate term;
extern crate rand;
#[macro_use]
extern crate tokio_core;
extern crate futures;
extern crate user;
extern crate shell_escape;

mod error;
mod commands;
mod meta;

macro_rules! pijul_subcommand_dispatch {
    ($p:expr => $($subcommand_name:expr => $subcommand:ident),*) => {{
        match $p {
            $(($subcommand_name, Some(args)) =>
             {
                 let mut params = commands::$subcommand::parse_args(args);
                 match commands::$subcommand::run(&mut params) {
                     Ok(_) => (),
                     Err(e) => {
                         println!("error: {}", e);
                         std::process::exit(1)
                     }
                 }
             }
              ),*
                ("", None) => {},
            _ => panic!("Incorrect subcommand name")
        }
    }}
}

fn main() {
    env_logger::init().unwrap();
    let time0 = chrono::Local::now();
    let version = crate_version!();
    let app = clap::App::new("pijul")
        .version(&version[..])
        .author("Pierre-Étienne Meunier and Florent Becker")
        .about("Version Control: fast, distributed, easy to use; pick any three");
    let app = app.subcommands(commands::all_command_invocations());

    let args = app.get_matches();
    pijul_subcommand_dispatch!(args.subcommand() =>
                               "info" => info,
                               "changes" => changes,
                               "patch" => patch,
                               "init" => init,
                               "add" => add,
                               "record" => record,
                               "pull" => pull,
                               "push" => push,
                               "apply" => apply,
                               "clone" => clone,
                               "remove" => remove,
                               "mv" => mv,
                               "ls" => ls,
                               "revert" => revert,
                               "unrecord" => unrecord,
                               "fork" => fork,
                               "branches" => branches,
                               "delete_branch" => delete_branch,
                               "checkout" => checkout
                               );
    let time1 = chrono::Local::now();
    info!("The command took: {:?}", time1.signed_duration_since(time0));
}