|
@@ -1,5 +1,7 @@
|
|
|
|
|
+use std::fmt;
|
|
|
|
|
|
|
|
-pub static OPTIONS: &str = r##"
|
|
|
|
|
|
|
+
|
|
|
|
|
+static OPTIONS: &str = r##"
|
|
|
-?, --help show list of command-line options
|
|
-?, --help show list of command-line options
|
|
|
-v, --version show version of exa
|
|
-v, --version show version of exa
|
|
|
|
|
|
|
@@ -23,10 +25,9 @@ FILTERING AND SORTING OPTIONS
|
|
|
-I, --ignore-glob GLOBS glob patterns (pipe-separated) of files to ignore
|
|
-I, --ignore-glob GLOBS glob patterns (pipe-separated) of files to ignore
|
|
|
Valid sort fields: name, Name, extension, Extension, size,
|
|
Valid sort fields: name, Name, extension, Extension, size,
|
|
|
modified, accessed, created, inode, none
|
|
modified, accessed, created, inode, none
|
|
|
-
|
|
|
|
|
"##;
|
|
"##;
|
|
|
|
|
|
|
|
-pub static LONG_OPTIONS: &str = r##"
|
|
|
|
|
|
|
+static LONG_OPTIONS: &str = r##"
|
|
|
LONG VIEW OPTIONS
|
|
LONG VIEW OPTIONS
|
|
|
-b, --binary list file sizes with binary prefixes
|
|
-b, --binary list file sizes with binary prefixes
|
|
|
-B, --bytes list file sizes in bytes, without any prefixes
|
|
-B, --bytes list file sizes in bytes, without any prefixes
|
|
@@ -39,8 +40,36 @@ LONG VIEW OPTIONS
|
|
|
-S, --blocks show number of file system blocks
|
|
-S, --blocks show number of file system blocks
|
|
|
-t, --time FIELD which timestamp field to list (modified, accessed, created)
|
|
-t, --time FIELD which timestamp field to list (modified, accessed, created)
|
|
|
-u, --accessed use the accessed timestamp field
|
|
-u, --accessed use the accessed timestamp field
|
|
|
- -U, --created use the created timestamp field
|
|
|
|
|
-"##;
|
|
|
|
|
|
|
+ -U, --created use the created timestamp field"##;
|
|
|
|
|
+
|
|
|
|
|
+static GIT_HELP: &str = r##" --git list each file's Git status, if tracked"##;
|
|
|
|
|
+static EXTENDED_HELP: &str = r##" -@, --extended list each file's extended attributes and sizes"##;
|
|
|
|
|
+
|
|
|
|
|
+#[derive(PartialEq, Debug)]
|
|
|
|
|
+pub struct HelpString {
|
|
|
|
|
+ pub only_long: bool,
|
|
|
|
|
+ pub git: bool,
|
|
|
|
|
+ pub xattrs: bool,
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+impl fmt::Display for HelpString {
|
|
|
|
|
+ fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
|
|
|
|
+ try!(write!(f, "Usage:\n exa [options] [files...]\n"));
|
|
|
|
|
+
|
|
|
|
|
+ if !self.only_long {
|
|
|
|
|
+ try!(write!(f, "{}", OPTIONS));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try!(write!(f, "{}", LONG_OPTIONS));
|
|
|
|
|
+
|
|
|
|
|
+ if self.git {
|
|
|
|
|
+ try!(write!(f, "\n{}", GIT_HELP));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if self.xattrs {
|
|
|
|
|
+ try!(write!(f, "\n{}", EXTENDED_HELP));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-pub static GIT_HELP: &str = r##" --git list each file's Git status, if tracked"##;
|
|
|
|
|
-pub static EXTENDED_HELP: &str = r##" -@, --extended list each file's extended attributes and sizes"##;
|
|
|
|
|
|
|
+ Ok(())
|
|
|
|
|
+ }
|
|
|
|
|
+}
|