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
9048e220
Commit
9048e220
authored
9 months ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
allow selective download of several attachments, attached to one issue
parent
5c98a217
Branches
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
+25
-9
25 additions, 9 deletions
lib/Redmine/CLI.pm
with
25 additions
and
9 deletions
lib/Redmine/CLI.pm
+
25
−
9
View file @
9048e220
...
@@ -281,6 +281,8 @@ sub interpret
...
@@ -281,6 +281,8 @@ sub interpret
return
undef
;
return
undef
;
}
}
my
@res
;
if
(
$op_mode
eq
'
help
')
{
usage
('
help
',
(
@$pars
)
?
shift
(
@$pars
)
:
'
overview
');
}
if
(
$op_mode
eq
'
help
')
{
usage
('
help
',
(
@$pars
)
?
shift
(
@$pars
)
:
'
overview
');
}
elsif
(
$op_mode
eq
'
exit
')
{
return
0
;
}
elsif
(
$op_mode
eq
'
exit
')
{
return
0
;
}
elsif
(
$op_mode
eq
'
interact
'
||
$op_mode
eq
'
i
')
elsif
(
$op_mode
eq
'
interact
'
||
$op_mode
eq
'
i
')
...
@@ -338,6 +340,7 @@ sub interpret
...
@@ -338,6 +340,7 @@ sub interpret
my
$out_tsv
=
$self
->
{
out_tsv
};
my
$out_tsv
=
$self
->
{
out_tsv
};
my
(
$proj_list
,
$csv
)
=
Redmine::CLI::
show_projects
(
$rm
,
$out_tsv
);
my
(
$proj_list
,
$csv
)
=
Redmine::CLI::
show_projects
(
$rm
,
$out_tsv
);
$self
->
{
project_list
}
=
$proj_list
;
$self
->
{
project_list
}
=
$proj_list
;
push
(
@res
,
$proj_list
);
}
}
elsif
(
$op_mode
eq
'
wiki
')
elsif
(
$op_mode
eq
'
wiki
')
{
{
...
@@ -375,8 +378,9 @@ sub interpret
...
@@ -375,8 +378,9 @@ sub interpret
push
(
@$pars
,
$self
->
{
ticket_number
})
if
(
!
@$pars
&&
exists
(
$self
->
{
ticket_number
}));
push
(
@$pars
,
$self
->
{
ticket_number
})
if
(
!
@$pars
&&
exists
(
$self
->
{
ticket_number
}));
foreach
my
$ticket_number
(
@$pars
)
foreach
my
$ticket_number
(
@$pars
)
{
{
Redmine::CLI::
show_issue
(
$rm
,
$ticket_number
);
my
$issue
=
Redmine::CLI::
show_issue
(
$rm
,
$ticket_number
);
$self
->
{
ticket_number
}
=
$ticket_number
;
$self
->
{
ticket_number
}
=
$ticket_number
;
push
(
@res
,
$issue
);
}
}
}
}
elsif
(
$op_mode
eq
'
att
')
elsif
(
$op_mode
eq
'
att
')
...
@@ -453,7 +457,7 @@ not needed?
...
@@ -453,7 +457,7 @@ not needed?
=end comment
=end comment
=cut
=cut
return
1
;
return
(
1
,
\
@res
)
;
}
}
sub
interact
sub
interact
...
@@ -474,7 +478,7 @@ sub interact
...
@@ -474,7 +478,7 @@ sub interact
my
(
$op
,
@pars
)
=
split
('
',
$l
);
my
(
$op
,
@pars
)
=
split
('
',
$l
);
print
"
op=[
$op
]
\n
";
print
"
op=[
$op
]
\n
";
my
$continue
=
interpret
(
$self
,
$op
,
\
@pars
);
my
(
$continue
)
=
interpret
(
$self
,
$op
,
\
@pars
);
last
unless
(
$continue
);
last
unless
(
$continue
);
}
}
}
}
...
@@ -745,7 +749,7 @@ sub download_attachment
...
@@ -745,7 +749,7 @@ sub download_attachment
{
{
my
$rm
=
shift
;
my
$rm
=
shift
;
my
$ticket_number
=
shift
;
my
$ticket_number
=
shift
;
my
$number
=
shift
||
0
;
my
$number
=
shift
;
my
$ua
=
$rm
->
{
ua
};
my
$ua
=
$rm
->
{
ua
};
return
undef
unless
(
defined
(
$ua
));
return
undef
unless
(
defined
(
$ua
));
...
@@ -755,13 +759,25 @@ sub download_attachment
...
@@ -755,13 +759,25 @@ sub download_attachment
# print "attachments: ", Dumper ($attachments);
# print "attachments: ", Dumper ($attachments);
return
undef
unless
(
defined
(
$attachments
));
return
undef
unless
(
defined
(
$attachments
));
my
$attachment
=
$attachments
->
[
$number
];
my
@attachment_numbers
;
return
undef
unless
(
defined
(
$attachment
));
if
(
!
defined
(
$number
)
||
$number
eq
'
*
')
{
push
(
@attachment_numbers
,
0
..
$#$attachments
);
}
print
"
attachment:
",
Dumper
(
$attachment
);
elsif
(
$number
=~
/^\d+$/
)
{
@attachment_numbers
=
$number
;
}
elsif
(
$number
=~
/^\d[\d,-]*\d$/
)
{
print
"
number ranges not yet implemented
\n
";
return
undef
;
}
print
__LINE__
,
"
attachment_numbers:
",
join
('
',
@attachment_numbers
),
"
\n
";
$ua
->
get
(
$attachment
->
{
content_url
},
'
:content_file
'
=>
$attachment
->
{
filename
});
my
@dl_attachments
;
foreach
my
$num
(
@attachment_numbers
)
{
my
$attachment
=
$attachments
->
[
$num
];
next
unless
(
defined
(
$attachment
));
# print __LINE__, " attachment: ", Dumper ($attachment);
print
__LINE__
,
"
attachment num=[
$num
]
",
$attachment
->
{
filename
},
"
\n
";
$ua
->
get
(
$attachment
->
{
content_url
},
'
:content_file
'
=>
$attachment
->
{
filename
});
push
(
@dl_attachments
,
$attachment
);
}
$attachment
;
return
(
wantarray
)
?
@dl_attachments
:
\
@dl_attachments
;
}
}
sub
usage
sub
usage
...
...
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