aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/command/add.rs2
-rw-r--r--src/command/generate.rs2
-rw-r--r--src/command/help.rs14
-rw-r--r--src/command/publish.rs2
-rw-r--r--src/command/publish_archive.rs2
-rw-r--r--src/command/sync_down.rs2
-rw-r--r--src/command/sync_up.rs2
7 files changed, 18 insertions, 8 deletions
diff --git a/src/command/add.rs b/src/command/add.rs
index 36f25a0..4c80917 100644
--- a/src/command/add.rs
+++ b/src/command/add.rs
@@ -27,6 +27,6 @@ impl super::Command for Add {
}
fn help(&self) -> &'static str {
- "<path_to_post>\t\tCreates new blog post"
+ "<path_to_post>\t\t\tCreates new blog post"
}
}
diff --git a/src/command/generate.rs b/src/command/generate.rs
index 943f2be..59babd5 100644
--- a/src/command/generate.rs
+++ b/src/command/generate.rs
@@ -27,6 +27,6 @@ impl super::Command for Generate {
}
fn help(&self) -> &'static str {
- "\t\t\tGenerates the blog assets"
+ "\t\t\t\tGenerates the blog assets"
}
}
diff --git a/src/command/help.rs b/src/command/help.rs
index 9b98393..628fd5a 100644
--- a/src/command/help.rs
+++ b/src/command/help.rs
@@ -1,4 +1,6 @@
+use std::env::args;
use std::io::Result;
+use super::available_commands;
pub struct Help;
@@ -13,8 +15,16 @@ impl super::Command for Help {
vec![]
}
- fn execute(&self, input: Option<&String>) -> Result<()> {
- println!("Help: {:?}!", input);
+ fn execute(&self, _: Option<&String>) -> Result<()> {
+ let arguments: Vec<String> = args().collect();
+ let app_name = arguments.get(0).map_or("blog", |s| s.as_str());
+ let commands = available_commands();
+ println!("Usage:");
+ println!("");
+ for command in commands {
+ print!("{} {} ", app_name, command.command());
+ println!("{}", command.help());
+ }
return Ok(())
}
diff --git a/src/command/publish.rs b/src/command/publish.rs
index d8ca949..d6116a4 100644
--- a/src/command/publish.rs
+++ b/src/command/publish.rs
@@ -27,6 +27,6 @@ impl super::Command for Publish {
}
fn help(&self) -> &'static str {
- "<destination>\tPublishes the blog to a remote host."
+ "<destination>\t\tPublishes the blog to a remote host"
}
}
diff --git a/src/command/publish_archive.rs b/src/command/publish_archive.rs
index 4275c38..6b98b1a 100644
--- a/src/command/publish_archive.rs
+++ b/src/command/publish_archive.rs
@@ -27,6 +27,6 @@ impl super::Command for PublishArchive {
}
fn help(&self) -> &'static str {
- "<destination>\tPublishes the archive to a remote host."
+ "<destination>\tPublishes the archive to a remote host"
}
}
diff --git a/src/command/sync_down.rs b/src/command/sync_down.rs
index a0c713b..c00b01a 100644
--- a/src/command/sync_down.rs
+++ b/src/command/sync_down.rs
@@ -27,7 +27,7 @@ impl super::Command for SyncDown {
}
fn help(&self) -> &'static str {
- "\t\t\tPulls from the git remote if configured"
+ "\t\t\t\tPulls from the git remote if configured"
}
}
diff --git a/src/command/sync_up.rs b/src/command/sync_up.rs
index cf49518..d35ce7f 100644
--- a/src/command/sync_up.rs
+++ b/src/command/sync_up.rs
@@ -27,6 +27,6 @@ impl super::Command for SyncUp {
}
fn help(&self) -> &'static str {
- "\t\t\t\tPushes to the git remote if configured."
+ "\t\t\t\tPushes to the git remote if configured"
}
}