]> git.mjollnir.org Git - cil.git/commitdiff
You can now type "cil help" as well as "cil --help" (closes #3)
authorAndrew Chilton <andychilton@gmail.com>
Sat, 5 Jun 2010 11:48:35 +0000 (23:48 +1200)
committerAndrew Chilton <andychilton@gmail.com>
Sat, 5 Jun 2010 11:48:35 +0000 (23:48 +1200)
bin/cil
lib/CIL/Command/Help.pm [new file with mode: 0644]

diff --git a/bin/cil b/bin/cil
index a2b41318fdcb4a37d192b0655122441094865e13..8bda9c2f4278993b09f4c376504e323ce42560f2 100755 (executable)
--- a/bin/cil
+++ b/bin/cil
@@ -95,7 +95,8 @@ my %BOOLEAN_ARGS = (
     }
 
     if ( exists $args->{help} ) {
-        usage();
+        use CIL::Command::Help;
+        CIL::Command::Help->run();
         exit;
     }
 
@@ -158,43 +159,6 @@ sub get_options {
     return $args;
 }
 
-## ----------------------------------------------------------------------------
-# program info
-
-sub usage {
-   print <<"END_USAGE";
-Usage: $0 COMMAND [options]
-
-Commands:
-   init    [--path=PATH]
-   add
-   summary [FILTERS...]
-   list    [FILTERS...]
-   show    ISSUE
-   status  NEW_STATUS [ISSUES...]
-   label   NEW_LABEL [ISSUES...]
-   steal   ISSUE
-   edit    ISSUE
-   comment ISSUE
-   attach  ISSUE FILENAME
-   extract ATTACHMENT [--filename=FILENAME]
-   am      EMAIL.TXT [--batch]
-   track   ISSUE
-   fsck
-
-Filters:
-   --status=?
-   --is-open
-   --is-closed
-   --label=?
-   --assigned-to=?
-   --is-mine
-
-See <http://www.chilts.org/project/cil/> for further information.
-Report bugs to <andychilton\@gmail.com>.
-END_USAGE
-}
-
 ## ----------------------------------------------------------------------------
 
 =head1 NAME
diff --git a/lib/CIL/Command/Help.pm b/lib/CIL/Command/Help.pm
new file mode 100644 (file)
index 0000000..440f36b
--- /dev/null
@@ -0,0 +1,71 @@
+## ----------------------------------------------------------------------------
+# cil is a Command line Issue List
+# Copyright (C) 2010 Andrew Chilton
+#
+# This file is part of 'cil'.
+#
+# cil is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+## ----------------------------------------------------------------------------
+
+package CIL::Command::Help;
+
+use strict;
+use warnings;
+
+use base qw(CIL::Command);
+
+## ----------------------------------------------------------------------------
+
+sub name { 'help' }
+
+sub run {
+    my ($class) = @_;
+
+   print <<"END_USAGE";
+Usage: $0 COMMAND [options]
+
+Commands:
+   init    [--path=PATH]
+   add
+   summary [FILTERS...]
+   list    [FILTERS...]
+   show    ISSUE
+   status  NEW_STATUS [ISSUES...]
+   label   NEW_LABEL [ISSUES...]
+   steal   ISSUE
+   edit    ISSUE
+   comment ISSUE
+   attach  ISSUE FILENAME
+   extract ATTACHMENT [--filename=FILENAME]
+   am      EMAIL.TXT [--batch]
+   track   ISSUE
+   fsck
+
+Filters:
+   --status=?
+   --is-open
+   --is-closed
+   --label=?
+   --assigned-to=?
+   --is-mine
+
+See <http://www.chilts.org/project/cil/> for further information.
+Report bugs to <andychilton\@gmail.com>.
+END_USAGE
+}
+
+1;
+
+## ----------------------------------------------------------------------------