// Copyright 2017 rust-ipfs-api Developers // // Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be // copied, modified, or distributed except according to those terms. // #[macro_use] extern crate clap; use crate::command::CliCommand; use ipfs_api::IpfsClient; mod command; macro_rules! main { ($($cmd:ident);*) => { fn main() { let matches = clap_app!( app => (name: "IPFS CLI") (about: "CLI for Go IPFS") (version: crate_version!()) (author: "Ferris T. ") (@setting SubcommandRequiredElseHelp) $((subcommand: ::signature()))* ).get_matches(); let client = IpfsClient::default(); let command = match matches.subcommand() { $( (::NAME, Some(args)) => { ::handle(&client, args) } )* _ => unreachable!(), }; hyper::rt::run(command); } } } main!( add; bitswap; block; bootstrap; cat; commands; config; dag; dht; diag; dns; file; files; filestore; shutdown; version );