summaryrefslogtreecommitdiffstats
path: root/ipfs-cli/src/command/shutdown.rs
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2018-06-27 15:54:50 -0400
committerFerris Tseng <ferristseng@fastmail.fm>2018-06-27 15:54:50 -0400
commitb786be1e6087a45f1db236f30d91803710c41274 (patch)
tree71c0b6beaf929c4b846d6719cbecad9bb64bf20b /ipfs-cli/src/command/shutdown.rs
parent6acbf0e0f710ca1c897b1242e84a908ca32b45c3 (diff)
upgrade for hyper 0.12; use macros to build commands
Diffstat (limited to 'ipfs-cli/src/command/shutdown.rs')
-rw-r--r--ipfs-cli/src/command/shutdown.rs29
1 files changed, 18 insertions, 11 deletions
diff --git a/ipfs-cli/src/command/shutdown.rs b/ipfs-cli/src/command/shutdown.rs
index 6cb9c1d..e32b7f1 100644
--- a/ipfs-cli/src/command/shutdown.rs
+++ b/ipfs-cli/src/command/shutdown.rs
@@ -7,17 +7,24 @@
//
use clap::App;
-use command::EXPECTED_API;
-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 shutdown =>
- (about: "Shutdown IPFS daemon")
- )
-}
+pub struct Command;
+
+impl CliCommand for Command {
+ const NAME: &'static str = "shutdown";
+
+ fn signature<'a, 'b>() -> App<'a, 'b> {
+ clap_app!(
+ @subcommand shutdown =>
+ (about: "Shutdown IPFS daemon")
+ )
+ }
-pub fn handle(core: &mut Core, client: &IpfsClient) {
- core.run(client.shutdown()).expect(EXPECTED_API);
+ handle!(
+ (_args, client) => {
+ client.shutdown().map(|_| ())
+ }
+ );
}