Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
variety
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
variety
Commits
cdc1a205
Commit
cdc1a205
authored
Nov 08, 2014
by
Tomas Dvorak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ascii output includes top and bottom border
parent
98eb5224
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
OutputFormatTest.java
...c/test/java/com/github/variety/test/OutputFormatTest.java
+4
-2
variety.js
variety.js
+5
-1
No files found.
test/src/test/java/com/github/variety/test/OutputFormatTest.java
View file @
cdc1a205
...
...
@@ -52,10 +52,11 @@ public class OutputFormatTest {
// filter only lines starting with character '|'
final
String
actual
=
Stream
.
of
(
analysis
.
getStdOut
().
split
(
"\n"
))
.
filter
(
line
->
line
.
startsWith
(
"|"
))
.
filter
(
line
->
line
.
startsWith
(
"|"
)
||
line
.
startsWith
(
"+"
)
)
.
collect
(
Collectors
.
joining
(
"\n"
));
final
String
expected
=
"+------------------------------------------------------------+\n"
+
"| key | types | occurrences | percents |\n"
+
"| ------------------ | ------------ | ----------- | -------- |\n"
+
"| _id | ObjectId | 5 | 100 |\n"
+
...
...
@@ -64,7 +65,8 @@ public class OutputFormatTest {
"| pets | String,Array | 2 | 40 |\n"
+
"| birthday | String | 2 | 40 |\n"
+
"| someBinData | BinData-old | 1 | 20 |\n"
+
"| someWeirdLegacyKey | String | 1 | 20 |"
;
"| someWeirdLegacyKey | String | 1 | 20 |\n"
+
"+------------------------------------------------------------+"
;
Assert
.
assertEquals
(
expected
,
actual
);
...
...
variety.js
View file @
cdc1a205
...
...
@@ -235,7 +235,11 @@ if(outputFormat === 'json') {
var
pad
=
function
(
width
,
string
,
symbol
)
{
return
(
width
<=
string
.
length
)
?
string
:
pad
(
width
,
string
+
symbol
,
symbol
);
};
var
output
=
""
;
table
.
forEach
(
function
(
row
,
ri
){
print
(
"| "
+
row
.
map
(
function
(
cell
,
i
)
{
return
pad
(
colMaxWidth
(
table
,
i
),
cell
,
ri
==
1
?
"-"
:
" "
);}).
join
(
" | "
)
+
" |
"
);
output
+=
(
"| "
+
row
.
map
(
function
(
cell
,
i
)
{
return
pad
(
colMaxWidth
(
table
,
i
),
cell
,
ri
==
1
?
"-"
:
" "
);}).
join
(
" | "
)
+
" |
\
n
"
);
});
var
lineLength
=
output
.
split
(
"
\
n"
)[
0
].
length
-
2
;
// length of first (header) line minus two chars for edges
var
border
=
"+"
+
pad
(
lineLength
,
""
,
"-"
)
+
"+"
;
print
(
border
+
"
\
n"
+
output
+
border
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment