Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
redmine-sync
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
redmine-sync
Commits
98215c5d
Commit
98215c5d
authored
2 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
added command to download attachments
parent
be425440
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Redmine/CLI.pm
+40
-2
40 additions, 2 deletions
lib/Redmine/CLI.pm
with
40 additions
and
2 deletions
lib/Redmine/CLI.pm
+
40
−
2
View file @
98215c5d
...
...
@@ -56,8 +56,12 @@ EOPOD
=head2 Overview
help [topic] (this overview)
list
show ticket
list ... list tickets in current project
show ticket ... show ticket with this number
att ticket nr ... download attachment nr <nr> from ticket <ticket>
instances ... list all instances
projects ... list all projects
=cut
EOPOD
...
...
@@ -375,6 +379,17 @@ sub interpret
$self
->
{
ticket_number
}
=
$ticket_number
;
}
}
elsif
(
$op_mode
eq
'
att
')
{
my
$rm
=
$mRM
->
attach
();
push
(
@$pars
,
$self
->
{
ticket_number
})
if
(
!
@$pars
&&
exists
(
$self
->
{
ticket_number
}));
my
$att_nr
=
$pars
->
[
1
];
foreach
my
$ticket_number
(
@$pars
)
{
Redmine::CLI::
download_attachment
(
$rm
,
$ticket_number
,
$att_nr
);
$self
->
{
ticket_number
}
=
$ticket_number
;
}
}
elsif
(
$op_mode
eq
'
browse
'
||
$op_mode
eq
'
display
')
{
my
$rm_cfg
=
$self
->
{
_rm_cfg
};
...
...
@@ -726,6 +741,29 @@ sub show_issue
$issue
;
}
sub
download_attachment
{
my
$rm
=
shift
;
my
$ticket_number
=
shift
;
my
$number
=
shift
||
0
;
my
$ua
=
$rm
->
{
ua
};
return
undef
unless
(
defined
(
$ua
));
my
$issue
=
$rm
->
issue
(
$ticket_number
,
{
include
=>
'
attachments
'
}
);
my
$attachments
=
$issue
->
{
issue
}
->
{
attachments
};
# print "attachments: ", Dumper ($attachments);
return
undef
unless
(
defined
(
$attachments
));
my
$attachment
=
$attachments
->
[
$number
];
return
undef
unless
(
defined
(
$attachment
));
print
"
attachment:
",
Dumper
(
$attachment
);
$ua
->
get
(
$attachment
->
{
content_url
},
'
:content_file
'
=>
$attachment
->
{
filename
});
$attachment
;
}
sub
usage
{
my
$pod
=
new
Pod::Simple::
Text
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment