From 58ddb9a788f8098a7479a1bea61fb07f175d388d Mon Sep 17 00:00:00 2001 From: Andrew Chilton Date: Sat, 5 Jun 2010 23:48:35 +1200 Subject: [PATCH] You can now type "cil help" as well as "cil --help" (closes #3) --- bin/cil | 40 ++--------------------- lib/CIL/Command/Help.pm | 71 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 38 deletions(-) create mode 100644 lib/CIL/Command/Help.pm diff --git a/bin/cil b/bin/cil index a2b4131..8bda9c2 100755 --- 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 for further information. -Report bugs to . -END_USAGE -} - ## ---------------------------------------------------------------------------- =head1 NAME diff --git a/lib/CIL/Command/Help.pm b/lib/CIL/Command/Help.pm new file mode 100644 index 0000000..440f36b --- /dev/null +++ b/lib/CIL/Command/Help.pm @@ -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 . +# +## ---------------------------------------------------------------------------- + +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 for further information. +Report bugs to . +END_USAGE +} + +1; + +## ---------------------------------------------------------------------------- -- 2.39.5