From 84b7fc0bdae6593c4404b6821aee765959132b29 Mon Sep 17 00:00:00 2001 From: Andrew Chilton Date: Wed, 2 Jul 2008 22:54:35 +1200 Subject: [PATCH] Added a filter --is-mine (closes #574046f9). --- README | 1 + bin/cil | 63 ++++++++++++++++++++++++++++++++++++++++--- issues/c_06e0d28c.cil | 11 ++++++++ issues/i_574046f9.cil | 5 ++-- 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 issues/c_06e0d28c.cil diff --git a/README b/README index 5feb695..bceb623 100644 --- 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 4190376..079e267 100755 --- 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 for further information. Report bugs to . 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 and C 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 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 turned on. + +=item --is-open, --is-closed + +These check both C and C 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. + +=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 index 0000000..63f2608 --- /dev/null +++ b/issues/c_06e0d28c.cil @@ -0,0 +1,11 @@ +Issue: 574046f9 +CreatedBy: Andrew Chilton +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. diff --git a/issues/i_574046f9.cil b/issues/i_574046f9.cil index 1cc395c..04c93be 100644 --- a/issues/i_574046f9.cil +++ b/issues/i_574046f9.cil @@ -1,9 +1,10 @@ Summary: Have a filter called '--is-mine' -Status: New +Status: Finished CreatedBy: Andrew Chilton AssignedTo: Andrew Chilton +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'. -- 2.39.5