summaryrefslogtreecommitdiff
path: root/bin/cil
diff options
context:
space:
mode:
Diffstat (limited to 'bin/cil')
-rwxr-xr-xbin/cil103
1 files changed, 93 insertions, 10 deletions
diff --git a/bin/cil b/bin/cil
index 5aaa020..1727a09 100755
--- a/bin/cil
+++ b/bin/cil
@@ -39,7 +39,7 @@ use CIL::Attachment;
my $y = 'y';
-use constant VERSION => '0.4.2';
+use constant VERSION => '0.5.0';
my @IN_OPTS = (
# strings
@@ -57,6 +57,7 @@ my @IN_OPTS = (
'assigned-to>a',# for 'summary', 'list'
# booleans
+ 'bare', # for 'init'
'is-open', # for 'summary', 'list'
'is-closed', # for 'summary', 'list'
'is-mine', # for 'summary', 'list'
@@ -67,6 +68,7 @@ my @IN_OPTS = (
my %BOOLEAN_ARGS = (
'help' => 1,
'version' => 1,
+ 'bare' => 1,
'is-open' => 1,
'is-closed' => 1,
'is-mine' => 1,
@@ -138,9 +140,29 @@ sub cmd_init {
}
# create a .cil file here also
- unless ( touch $config ) {
- rmdir $issues_dir;
- fatal("couldn't create a '$config' file");
+ if ( $args->{bare} ) {
+ unless ( touch $config ) {
+ rmdir $issues_dir;
+ fatal("couldn't create a '$config' file");
+ }
+ }
+ else {
+ # write a default .cil file
+ write_file($config, <<'CONFIG');
+StatusStrict: 1
+StatusAllowedList: New
+StatusAllowedList: InProgress
+StatusAllowedList: Finished
+StatusOpenList: New
+StatusOpenList: InProgress
+StatusClosedList: Finished
+LabelStrict: 1
+LabelAllowedList: Type-Enhancement
+LabelAllowedList: Type-Defect
+LabelAllowedList: Priority-High
+LabelAllowedList: Priority-Medium
+LabelAllowedList: Priority-Low
+CONFIG
}
# add a README.txt so people know what this is about
@@ -221,6 +243,19 @@ sub cmd_status {
display_issue($cil, $issue);
}
+sub cmd_steal {
+ my ($cil, undef, $issue_name) = @_;
+
+ # firstly, read the issue in
+ my $issue = load_issue_fuzzy( $cil, $issue_name );
+
+ # set the AssignedTo for this issue to you (because you're stealing it)
+ $issue->AssignedTo( user($cil) );
+ $issue->save($cil);
+
+ display_issue($cil, $issue);
+}
+
sub cmd_add {
my ($cil, undef, $issue_name) = @_;
@@ -345,6 +380,26 @@ sub cmd_extract {
write_file( $filename, $attachment->as_binary );
}
+sub cmd_track {
+ my ($cil, $args, $issue_name) = @_;
+
+ fatal("the 'VCS' option in your .cil file is not set")
+ unless defined $cil->VCS;
+
+ fatal("the 'VCS' option currently only supports values of 'Git'")
+ unless $cil->VCS eq 'Git';
+
+ my $issue = load_issue_fuzzy($cil, $issue_name);
+
+ # add the issue to Git
+ my $issue_dir = $cil->IssueDir();
+ my @files;
+ push @files, "$issue_dir/i_" . $issue->name . '.cil';
+ push @files, map { "$issue_dir/c_${_}.cil" } @{ $issue->CommentList };
+ push @files, map { "$issue_dir/a_${_}.cil" } @{ $issue->AttachmentList };
+ msg("git add @files");
+}
+
sub cmd_fsck {
my ($cil, $args) = @_;
@@ -1021,10 +1076,13 @@ Commands:
list [FILTERS...]
show ISSUE
status ISSUE NEW_STATUS
+ steal ISSUE
edit ISSUE
comment ISSUE
attach ISSUE FILENAME
extract ATTACHMENT [--filename=FILENAME]
+ am EMAIL.TXT
+ track ISSUE
fsck
Filters:
@@ -1072,6 +1130,7 @@ cil - the command-line issue list
$ cil am email.txt
+ $ cil track
$ cil fsck
=head1 DESCRIPTION
@@ -1081,11 +1140,15 @@ and attachments as local files which you can check in to your repository.
=over
-=item init [--path=PATH]
+=item init [--path=PATH] [--bare]
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.
+Usually, cil will write a small C<.cil> file such that you can use various
+filter commands immediately and can also serve as an example config file. Using
+C<--bare> just touches the C<.cil> config file ready for your own manipulation.
+
=item summary [filters]
Displays a one line summary for each issue. You may filter on both the Status
@@ -1124,6 +1187,12 @@ completeness. ie. issue 1 has to be completed before issue 2.
Shortcut so that you can set a new status on an issue without having to edit
it.
+=item steal ISSUE
+
+Shortcut to assign this issue to yourself. It reads your C<~/.cilrc> file for
+your UserName and UserEmail and uses this to populate the C<AssignedTo> field
+in the issue.
+
=item edit ISSUE
Edits the issue. If it changes, set the updates time to now.
@@ -1141,11 +1210,6 @@ Adds that particular filename to an existing issue.
Extracts the file from the attachment number. If filename if given uses that,
otherwise it will use the original one saved along with the attachment.
-=item fsck
-
-Tries to help you organise your issues if any aren't valid or have broken
-relationships.
-
=item am
Applies an email message to the issue list. It tries to figure out the type of
@@ -1156,6 +1220,17 @@ issue names, it presumes it's a new issue and adds that.
Note: this command will deal with Mailbox format files later on.
+=item track ISSUE
+
+This command outputs one or more command which you should run so that your VCS
+knows about your issue. It makes sure all the comments and attachments are done
+too.
+
+=item fsck
+
+Tries to help you organise your issues if any aren't valid or have broken
+relationships.
+
=back
=head1 FILTERS
@@ -1204,6 +1279,7 @@ may be declared multiple times:
The C<.cil> file is fairly simple and an example can be seen here:
+ VCS: Git
StatusStrict: 1
StatusAllowedList: New
StatusAllowedList: InProgress
@@ -1220,6 +1296,13 @@ The C<.cil> file is fairly simple and an example can be seen here:
=over
+=item VCS
+
+Default: empty, Type: Enum(Git)
+
+Currently this option only supports Git. This enables you to use the 'track'
+command.
+
=item StatusStrict
Default: 0, Type: Boolean (0/1)