Added a filter --is-mine (closes #574046f9).
authorAndrew Chilton <andychilton@gmail.com>
Wed, 2 Jul 2008 10:54:35 +0000 (22:54 +1200)
committerAndrew Chilton <andychilton@gmail.com>
Wed, 2 Jul 2008 10:54:35 +0000 (22:54 +1200)
README
bin/cil
issues/c_06e0d28c.cil [new file with mode: 0644]
issues/i_574046f9.cil

diff --git a/README b/README
index 5feb695971445bc24b941ca6efcacfbf5d51353e..bceb62360564e458a4110cbd76f20a64e788a2ba 100644 (file)
--- a/README
+++ b/README
@@ -38,6 +38,7 @@ When listing the issues, they can also be filtered:
  $ cil list --label=Type-Enhancement
  $ cil list --is-open
  $ cil list --label=Milestone-v0.3 --is-open
+ $ cil list --is-mine
 
 You can see what the issue name is by looking at the 'Issue' title. Imagine it
 is 'cafebabe' (which by default is the time from epoch). To see your issue
diff --git a/bin/cil b/bin/cil
index 4190376d6b2b9f5375252bb755e999ebe49b2a7b..079e26708ce37e6c4f1a58a1f38074389b977485 100755 (executable)
--- a/bin/cil
+++ b/bin/cil
@@ -59,6 +59,7 @@ my @IN_OPTS = (
     # booleans
     'is-open',      # for 'summary', 'list'
     'is-closed',    # for 'summary', 'list'
+    'is-mine',      # for 'summary', 'list'
     'help',
     'version',
 );
@@ -68,6 +69,7 @@ my %BOOLEAN_ARGS = (
     'version'   => 1,
     'is-open'   => 1,
     'is-closed' => 1,
+    'is-mine'   => 1,
 );
 
 ## ----------------------------------------------------------------------------
@@ -762,6 +764,11 @@ sub filter_issues {
     # don't filter if we haven't been given anything
     return $issues unless %$args;
 
+    # check that they aren't filtering on both --assigned-to and --is-mine
+    if ( defined $args->{a} and defined $args->{'is-mine'} ) {
+        fatal("the --assigned-to and --is-mine filters are mutually exclusive");
+    }
+
     # take a copy of the whole lot first (so we don't destroy the input list)
     my @new_issues = @$issues;
 
@@ -796,6 +803,8 @@ sub filter_issues {
     }
 
     # filter out 'assigned to'
+    $args->{a} = $cil->UserEmail
+        if defined $args->{'is-mine'};
     if ( defined $args->{a} ) {
         @new_issues = grep { $args->{a} eq $_->assigned_to_email } @new_issues;
     }
@@ -1009,8 +1018,8 @@ Usage: $0 COMMAND [options]
 Commands:
    init    [--path=PATH]
    add
-   summary [--status=STATUS] [--label=LABEL] [--is-open] [--is-closed]
-   list    [--status=STATUS] [--label=LABEL] [--is-open] [--is-closed]
+   summary [FILTERS...]
+   list    [FILTERS...]
    show    ISSUE
    status  ISSUE NEW_STATUS
    edit    ISSUE
@@ -1019,6 +1028,14 @@ Commands:
    extract ATTACHMENT [--filename=FILENAME]
    fsck
 
+Filters:
+   --status=?
+   --is-open
+   --is-closed
+   --label=?
+   --assigned-to=?
+   --is-mine
+
 See <http://kapiti.geek.nz/software/cil.html> for further information.
 Report bugs to <andychilton -at- gmail -dot- com>.
 END_USAGE
@@ -1070,12 +1087,12 @@ and attachments as local files which you can check in to your repository.
 Creates a local '.cil' file and an 'issues' directory. If PATH is specified,
 the config file and directory will be created in the destination directory.
 
-=item summary [--status=STATUS] [--label=LABEL] [--is-open] [--is-closed]
+=item summary [filters]
 
 Displays a one line summary for each issue. You may filter on both the Status
 and Label fields.
 
-=item list [--status=STATUS] [--label=LABEL] [--is-open] [--is-closed]
+=item list [filters]
 
 Shows each issue with more information. You may filter on both the Status and
 Label fields.
@@ -1140,6 +1157,44 @@ issue names, it presumes it's a new issue and adds that.
 
 =back
 
+=head1 FILTERS
+
+Filters can be used on both the C<summary> and C<list> commands. Most can be
+combined. See each individual filter for details.
+
+=over
+
+=item --status=STATUS
+
+You can choose any of the Statuses which might appear in your issues. This
+status does not have to be defined in your C<.cil> file, even if you have
+C<StatusStrict> turned on.
+
+=item --label=LABEL
+
+You can choose any of the Labels which might appear in your issues. This
+label does not have to be defined in your C<.cil> file, even if you have
+C<LabelStrict> turned on.
+
+=item --is-open, --is-closed
+
+These check both C<StatusOpenList> and C<StatusClosedList> from your C<.cil>
+file. If both are specified, you're likely to get no issues unless you
+explicitely defined a status as being in both lists (for whatever reason you
+have).
+
+=item --assigned-to=EMAIL_ADDRESS, --is-mine
+
+These items are mutually exclusive. The C<--assigned-to> just checks the email
+address in the AssignedTo field. It does not match anything else in that field,
+including any preceding name or any angle brackets.
+
+The C<--is-mine> filter is a shortcut to asking if AssignedTo is you. Cil knows
+your email address if you define it in your user's C<~/.cilrc> file as
+C<UserEmail>.
+
+=back
+
 =head1 .cil
 
 The C<.cil> file is used to configure bits and pieces within cil for this
diff --git a/issues/c_06e0d28c.cil b/issues/c_06e0d28c.cil
new file mode 100644 (file)
index 0000000..63f2608
--- /dev/null
@@ -0,0 +1,11 @@
+Issue: 574046f9
+CreatedBy: Andrew Chilton <andychilton@gmail.com>
+Inserted: 2008-07-02T10:51:45
+Updated: 2008-07-02T10:53:10
+
+Added the ability to use --is-mine. Also, when adding the documnentation, I
+moved the filters to their own section.
+
+Basically, --is-mine takes the email defined in ~/.cilrc and applies it by just
+overwriting --assigned-by, internally. This is okay since these two options are
+mutually exclusive.
index 1cc395c15fc4d6a0baa45329792ee2ca85e73093..04c93be91145304a806646ade160d6b8644a6bab 100644 (file)
@@ -1,9 +1,10 @@
 Summary: Have a filter called '--is-mine'
-Status: New
+Status: Finished
 CreatedBy: Andrew Chilton <andychilton@gmail.com>
 AssignedTo: Andrew Chilton <andychilton@gmail.com>
+Comment: 06e0d28c
 Inserted: 2008-07-02T10:16:59
-Updated: 2008-07-02T10:18:54
+Updated: 2008-07-02T10:53:10
 
 By having a filter '--is-mine', means it's much easier to type than
 '--assigned-to=andychilton-at-gmail-dot-com'.