FS-7988 add attach and comment
This commit is contained in:
parent
7ea5dabd0d
commit
5818a24ca5
|
@ -14,7 +14,7 @@ my $default_components = "freeswitch-core";
|
||||||
sub getpass {
|
sub getpass {
|
||||||
ReadMode( "noecho");
|
ReadMode( "noecho");
|
||||||
print "Password: ";
|
print "Password: ";
|
||||||
chomp (my $pwd = <>);
|
chomp (my $pwd = <STDIN>);
|
||||||
ReadMode ("original");
|
ReadMode ("original");
|
||||||
return $pwd;
|
return $pwd;
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,12 @@ sub getfield {
|
||||||
my $default = shift;
|
my $default = shift;
|
||||||
|
|
||||||
print $prompt . ($default ? "[$default]: " : "");
|
print $prompt . ($default ? "[$default]: " : "");
|
||||||
chomp (my $data = <>);
|
chomp (my $data = <STDIN>);
|
||||||
|
|
||||||
if (!$data) {
|
if (!$data) {
|
||||||
$data = $default;
|
$data = $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +58,9 @@ my $hashtxt = `git log -1 --oneline 2>/dev/null`;
|
||||||
my ($hash) = split(" ", $hashtxt);
|
my ($hash) = split(" ", $hashtxt);
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
|
'bug=s' => \$opts{bug},
|
||||||
|
'attach' => \$opts{attach},
|
||||||
|
'comment=s' => \$opts{comment},
|
||||||
'project=s' => \$opts{project},
|
'project=s' => \$opts{project},
|
||||||
'summary=s' => \$opts{summary},
|
'summary=s' => \$opts{summary},
|
||||||
'desc=s' => \$opts{desc},
|
'desc=s' => \$opts{desc},
|
||||||
|
@ -88,12 +93,12 @@ if ($opts{components}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$opts{user}) {
|
if (!$opts{user}) {
|
||||||
$opts{user} = getfield("User: ");
|
$opts{user} = getfield("User: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$opts{pass} && !$opts{debug}) {
|
if (!$opts{pass} && !$opts{debug}) {
|
||||||
$opts{pass} = getpass();
|
$opts{pass} = getpass();
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $jira;
|
my $jira;
|
||||||
|
@ -104,6 +109,38 @@ if (!$opts{debug}) {
|
||||||
$issue = $jira->GET("/issue/FS-7985") or die "login incorrect:";
|
$issue = $jira->GET("/issue/FS-7985") or die "login incorrect:";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($opts{bug}) {
|
||||||
|
if ($opts{comment}) {
|
||||||
|
|
||||||
|
if ($opts{comment} eq "edit") {
|
||||||
|
$opts{comment} = get_text();
|
||||||
|
}
|
||||||
|
|
||||||
|
my $input = {
|
||||||
|
update => {
|
||||||
|
comment =>
|
||||||
|
[{
|
||||||
|
add => {
|
||||||
|
body => $opts{comment}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$jira->PUT("/issue/" . $opts{bug}, undef, $input);
|
||||||
|
print "Comment Posted.\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($opts{attach}) {
|
||||||
|
$jira->attach_files($opts{bug}, @ARGV);
|
||||||
|
printf "%d file%s attached.\n", scalar @ARGV, scalar @ARGV == 1 ? "" : "s";
|
||||||
|
}
|
||||||
|
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#print $issue->{key};
|
#print $issue->{key};
|
||||||
#exit;
|
#exit;
|
||||||
|
|
||||||
|
@ -174,5 +211,10 @@ if ($opts{debug}) {
|
||||||
} else {
|
} else {
|
||||||
$issue = $jira->POST('/issue', undef, $input) or die "Issue was not created:";
|
$issue = $jira->POST('/issue', undef, $input) or die "Issue was not created:";
|
||||||
print "Issue Posted: " . $issue->{key};
|
print "Issue Posted: " . $issue->{key};
|
||||||
|
|
||||||
|
if ($opts{attach}) {
|
||||||
|
$jira->attach_files($issue->{key}, @ARGV);
|
||||||
|
printf "%d file%s attached.\n", scalar @ARGV, scalar @ARGV == 1 ? "" : "s";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue