Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aix-pm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
aix-pm
Commits
db606f5b
Commit
db606f5b
authored
Dec 19, 2017
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
new border styles: Redmine and Gnome
parent
5a7a4e5a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/util/Util/Matrix.pm
+43
-20
43 additions, 20 deletions
modules/util/Util/Matrix.pm
modules/util/csv.pl
+5
-1
5 additions, 1 deletion
modules/util/csv.pl
with
48 additions
and
21 deletions
modules/util/Util/Matrix.pm
+
43
−
20
View file @
db606f5b
#
Util::Matrix::
set_border_style
('
Redmine
');
# $Id: Matrix.pm,v 1.12 2017/03/26 05:35:49 gonter Exp $
#
...
...
@@ -7,12 +9,13 @@ package Util::Matrix;
my
$VERSION
=
0.03
;
# formatted matrix output
my
$border_left
=
'
|
';
my
$border_inter
=
'
|
';
my
$border_right
=
'
|
';
my
$border_left
=
my
$header_left
=
'
|
';
my
$border_inter
=
my
$header_inter
=
'
|
';
my
$border_right
=
my
$header_right
=
'
|
';
my
$border_lx
=
'
+
';
my
$border_rx
=
'
-+
';
my
$border_lines
=
1
;
my
$border_header
=
1
;
my
$header_style
=
'
default
';
...
...
@@ -52,17 +55,17 @@ sub print
print
$fh
$hl
,
"
\n
"
if
(
$border_lines
);
print
$fh
$
bor
der_left
if
(
$
bor
der_left
);
print
$fh
$
hea
der_left
if
(
$
hea
der_left
);
foreach
my
$n
(
@$column_names
)
{
print
$fh
$
bor
der_inter
if
(
$i
);
print
$fh
$
hea
der_inter
if
(
$i
);
printf
$fh
(
$fmt_l
[
$i
],
$n
);
$i
++
;
}
print
$fh
$
bor
der_right
if
(
$
bor
der_right
);
print
$fh
$
hea
der_right
if
(
$
hea
der_right
);
print
$fh
"
\n
";
print
$fh
$hl
,
"
\n
"
if
(
$border_
lines
);
print
$fh
$hl
,
"
\n
"
if
(
$border_
header
);
}
foreach
my
$row
(
@$d
)
...
...
@@ -106,32 +109,52 @@ sub print_hash
Util::Matrix::
print
(
$column_names
,
\
@d
,
$fh
);
}
sub
set_border_none
{
$header_left
=
$header_inter
=
$header_right
=
$border_left
=
$border_inter
=
$border_right
=
$border_lx
=
$border_rx
=
'';
$border_lines
=
$border_header
=
0
;
}
sub
set_border_style
{
my
$style
=
shift
;
if
(
$style
eq
'
none
')
{
$border_left
=
$border_inter
=
$border_right
=
$border_lx
=
$border_rx
=
'';
$border_lines
=
0
;
}
if
(
$style
eq
'
none
')
{
set_border_none
();
}
elsif
(
$style
eq
'
minimal
'
||
$style
eq
'')
{
$
border_
left
=
''
;
set_
border_
none
()
;
$border_inter
=
'
';
$border_right
=
'';
$border_lx
=
'';
$border_rx
=
'';
$border_lines
=
0
;
}
els
e
els
if
(
$style
eq
'
Redmine
')
{
# or $style eq 'default'
$header_left
=
'
|_.
';
$header_inter
=
'
|_.
';
$header_right
=
'
|
';
$border_left
=
'
|
';
$border_inter
=
'
|
';
$border_right
=
'
|
';
$border_lx
=
$border_rx
=
'';
$border_lines
=
$border_header
=
0
;
}
elsif
(
$style
eq
'
Gnome
')
{
$header_left
=
$border_left
=
'
|
';
$header_inter
=
$border_inter
=
'
|
';
$header_right
=
$border_right
=
'
|
';
$border_lx
=
'
|:
';
$border_rx
=
'
-|
';
$border_lines
=
0
;
$border_header
=
1
;
}
else
{
# or $style eq 'default' or 'matrix'
$header_left
=
$border_left
=
'
|
';
$header_inter
=
$border_inter
=
'
|
';
$header_right
=
$border_right
=
'
|
';
$border_lx
=
'
+
';
$border_rx
=
'
-+
';
$border_lines
=
1
;
$border_lines
=
$border_header
=
1
;
}
}
...
...
This diff is collapsed.
Click to expand it.
modules/util/csv.pl
+
5
−
1
View file @
db606f5b
...
...
@@ -147,6 +147,9 @@ while (defined (my $arg= shift (@ARGV)))
elsif
(
$opt
eq
'
a
')
{
$all
=
1
;
}
elsif
(
$opt
eq
'
x
')
{
$view
=
'
extended
';
}
elsif
(
$opt
eq
'
J
')
{
$view
=
'
json
';
}
elsif
(
$opt
eq
'
M
')
{
$view
=
'
matrix
';
}
elsif
(
$opt
eq
'
R
')
{
$view
=
'
Redmine
';
}
elsif
(
$opt
eq
'
G
')
{
$view
=
'
Gnome
';
}
elsif
(
$opt
eq
'
D
')
{
$view
=
'
dumper
';
}
elsif
(
$opt
eq
'
8
')
{
set_utf8
();
}
elsif
(
$opt
eq
'
9
')
{
$CSV_SEP
=
"
\t
";
}
...
...
@@ -298,7 +301,7 @@ if (@sort_columns)
}
my
$d
;
if
(
$view
eq
'
matrix
')
if
(
$view
eq
'
matrix
'
||
$view
eq
'
Redmine
'
||
$view
eq
'
Gnome
'
)
{
if
(
$out_file
)
{
...
...
@@ -309,6 +312,7 @@ if ($view eq 'matrix')
}
else
{
Util::Matrix::
set_border_style
(
$view
);
$csv
->
matrix_view
(
\
@columns
);
}
}
...
...
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