diff options
Diffstat (limited to 'ipfs-cli/src/command/version.rs')
-rw-r--r-- | ipfs-cli/src/command/version.rs | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/ipfs-cli/src/command/version.rs b/ipfs-cli/src/command/version.rs index eea3f7f..bdafa33 100644 --- a/ipfs-cli/src/command/version.rs +++ b/ipfs-cli/src/command/version.rs @@ -7,25 +7,32 @@ // use clap::App; -use ipfs_api::IpfsClient; -use tokio_core::reactor::Core; +use command::CliCommand; +use futures::Future; -pub fn signature<'a, 'b>() -> App<'a, 'b> { - clap_app!( - @subcommand version => - (about: "Show ipfs version information") - ) -} +pub struct Command; + +impl CliCommand for Command { + const NAME: &'static str = "version"; -pub fn handle(core: &mut Core, client: &IpfsClient) { - let version = core.run(client.version()) - .expect("expected response from API"); + fn signature<'a, 'b>() -> App<'a, 'b> { + clap_app!( + @subcommand version => + (about: "Show ipfs version information") + ) + } - println!(); - println!(" version : {}", version.version); - println!(" commit : {}", version.commit); - println!(" repo : {}", version.repo); - println!(" system : {}", version.system); - println!(" golang : {}", version.golang); - println!(); + handle!( + (_args, client) => { + client.version().map(|version| { + println!(); + println!(" version : {}", version.version); + println!(" commit : {}", version.commit); + println!(" repo : {}", version.repo); + println!(" system : {}", version.system); + println!(" golang : {}", version.golang); + println!(); + }) + } + ); } |