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
195753c3
Commit
195753c3
authored
8 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
added option to save ticket listing as tsv file
parent
c45d363a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/Redmine/CLI.pm
+15
-7
15 additions, 7 deletions
lib/Redmine/CLI.pm
lib/Redmine/Wrapper.pm
+4
-0
4 additions, 0 deletions
lib/Redmine/Wrapper.pm
with
19 additions
and
7 deletions
lib/Redmine/CLI.pm
+
15
−
7
View file @
195753c3
...
@@ -64,6 +64,7 @@ EOPOD
...
@@ -64,6 +64,7 @@ EOPOD
project_name
project_name
ticket_number
ticket_number
out_csv
=cut
=cut
EOPOD
EOPOD
...
@@ -72,7 +73,7 @@ EOPOD
...
@@ -72,7 +73,7 @@ EOPOD
my
$default_config_fnm
=
'
redmine.json
';
my
$default_config_fnm
=
'
redmine.json
';
my
@default_home_dirs
=
('
etc
',
undef
,
'
bin
');
my
@default_home_dirs
=
('
etc
',
undef
,
'
bin
');
my
@env_vars
=
qw(project_name ticket_number)
;
my
@env_vars
=
qw(project_name ticket_number
out_csv
)
;
my
%env_vars
=
map
{
$_
=>
1
}
@env_vars
;
my
%env_vars
=
map
{
$_
=>
1
}
@env_vars
;
sub
new
sub
new
...
@@ -100,7 +101,7 @@ sub new
...
@@ -100,7 +101,7 @@ sub new
# print "NOTE: trying [$f] as config filen name\n";
# print "NOTE: trying [$f] as config filen name\n";
if
(
-
f
$f
)
if
(
-
f
$f
)
{
{
#
print "NOTE: picked [$f] as config filen name\n";
print
"
NOTE: picked [
$f
] as config filen name
\n
";
$obj
->
{'
cfg_fnm
'}
=
$f
;
$obj
->
{'
cfg_fnm
'}
=
$f
;
last
;
last
;
}
}
...
@@ -152,9 +153,8 @@ sub parse_args
...
@@ -152,9 +153,8 @@ sub parse_args
elsif
(
$opt
eq
'
config
')
{
$self
->
{
cfg_fnm
}
=
$val
||
shift
(
@ARGV
);
}
elsif
(
$opt
eq
'
config
')
{
$self
->
{
cfg_fnm
}
=
$val
||
shift
(
@ARGV
);
}
elsif
(
$opt
eq
'
stanza
')
{
$self
->
{
cfg_stanza
}
=
$val
||
shift
(
@ARGV
);
}
elsif
(
$opt
eq
'
stanza
')
{
$self
->
{
cfg_stanza
}
=
$val
||
shift
(
@ARGV
);
}
elsif
(
$opt
eq
'
project
')
{
$self
->
{
project_name
}
=
$val
||
shift
(
@ARGV
);
}
elsif
(
$opt
eq
'
project
')
{
$self
->
{
project_name
}
=
$val
||
shift
(
@ARGV
);
}
# elsif ($opt eq 'show') { $self->{op_mode}= 'show'; }
elsif
(
$opt
eq
'
out
')
{
$self
->
{
out_csv
}
=
$val
||
shift
(
@ARGV
);
}
# elsif ($opt eq 'list') { $self->{op_mode}= 'list'; }
# TODO: allow extra arguments for plugins or otherwise
# TODO: allow extra arguments
else
{
usage
('
error
',
"
unknown option --
${arg}
");
exit
(
0
);
}
else
{
usage
('
error
',
"
unknown option --
${arg}
");
exit
(
0
);
}
}
}
elsif
(
$arg
=~
/^-(.+)/
)
elsif
(
$arg
=~
/^-(.+)/
)
...
@@ -266,7 +266,7 @@ sub interpret
...
@@ -266,7 +266,7 @@ sub interpret
{
{
foreach
my
$an
(
@env_vars
)
foreach
my
$an
(
@env_vars
)
{
{
printf
("
%
12
s = '%s'
\n
",
$an
,
$self
->
{
$an
});
printf
("
%
-15
s = '%s'
\n
",
$an
,
$self
->
{
$an
});
}
}
}
}
elsif
(
$op_mode
eq
'
set
')
elsif
(
$op_mode
eq
'
set
')
...
@@ -289,7 +289,8 @@ sub interpret
...
@@ -289,7 +289,8 @@ sub interpret
my
$project_name
=
(
@$pars
)
?
shift
(
@$pars
)
:
$self
->
{
project_name
};
my
$project_name
=
(
@$pars
)
?
shift
(
@$pars
)
:
$self
->
{
project_name
};
print
"
project_name=[
$project_name
]
\n
";
print
"
project_name=[
$project_name
]
\n
";
Redmine::CLI::
show_issues
(
$rm
,
$project_name
);
my
$out_csv
=
$self
->
{
out_csv
};
Redmine::CLI::
show_issues
(
$rm
,
$project_name
,
$out_csv
);
}
}
elsif
(
$op_mode
eq
'
show
')
elsif
(
$op_mode
eq
'
show
')
{
{
...
@@ -385,6 +386,7 @@ sub show_issues
...
@@ -385,6 +386,7 @@ sub show_issues
{
{
my
$rm
=
shift
;
my
$rm
=
shift
;
my
$proj_name
=
shift
;
my
$proj_name
=
shift
;
my
$save_as_tsv
=
shift
;
my
$proj
=
$rm
->
project
(
$proj_name
);
my
$proj
=
$rm
->
project
(
$proj_name
);
print
"
proj_name=[
$proj_name
] proj:
",
Dumper
(
$proj
);
print
"
proj_name=[
$proj_name
] proj:
",
Dumper
(
$proj
);
...
@@ -432,6 +434,12 @@ sub show_issues
...
@@ -432,6 +434,12 @@ sub show_issues
$csv
->
sort
('
subject
',
0
,
0
);
$csv
->
sort
('
subject
',
0
,
0
);
$csv
->
matrix_view
(
\
@columns1
);
$csv
->
matrix_view
(
\
@columns1
);
if
(
defined
(
$save_as_tsv
))
{
print
"
saving tsv file to '
$save_as_tsv
'
\n
";
$csv
->
save_csv_file
(
separator
=>
"
\t
",
filename
=>
$save_as_tsv
);
}
}
}
sub
filter1
sub
filter1
...
...
This diff is collapsed.
Click to expand it.
lib/Redmine/Wrapper.pm
+
4
−
0
View file @
195753c3
...
@@ -10,6 +10,8 @@ my %automapping=
...
@@ -10,6 +10,8 @@ my %automapping=
'
project_ids
'
=>
1
,
'
project_ids
'
=>
1
,
);
);
my
%USER_NAMES
=
map
{
$_
=>
1
}
qw(assigned_to)
;
sub
new
sub
new
{
{
my
$class
=
shift
;
my
$class
=
shift
;
...
@@ -57,6 +59,8 @@ sub get_mapped_id
...
@@ -57,6 +59,8 @@ sub get_mapped_id
my
$c
=
$self
->
{'
cfg
'};
my
$c
=
$self
->
{'
cfg
'};
# print "cfg: ", main::Dumper ($c);
# print "cfg: ", main::Dumper ($c);
$map_name
=
'
user
'
if
(
exists
(
$USER_NAMES
{
$map_name
}));
my
$m
=
$c
->
{
$map_name
.
'
_ids
'};
my
$m
=
$c
->
{
$map_name
.
'
_ids
'};
# print "map_name=[$map_name] name=[$name] m=", main::Dumper ($m);
# print "map_name=[$map_name] name=[$name] m=", main::Dumper ($m);
...
...
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