Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Robert Spencer
wiaflos
Commits
05876874
Commit
05876874
authored
Nov 28, 2016
by
Nigel Kukard
Browse files
Reworked the loading of files
parent
15aa0af0
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
05876874
...
...
@@ -38,7 +38,7 @@ test_job:
-
awitpt/bin/convert-tsql sqlite database/schema.tsql > database/schema.sqlite
-
sqlite3 wiaflos.sqlite < database/schema.sqlite
# Load data
-
./wiaflos-admin --config=wiaflos-server.conf --connect="local" --
stdin <
build/combined.wiaflos
-
./wiaflos-admin --config=wiaflos-server.conf --connect="local" --
load-file
build/combined.wiaflos
# Artifacts
artifacts
:
expire_in
:
1 day
...
...
wiaflos-admin
View file @
05876874
...
...
@@ -42,7 +42,7 @@ GetOptions(
"
connect=s
",
"
stdin
",
"
load-file=s
",
"
help
"
);
...
...
wiaflos/client/cmdline.pm
View file @
05876874
...
...
@@ -150,15 +150,22 @@ sub ui_start
}
# Check if we using raw stdin
if
(
defined
(
$cmdline
->
{'
stdin
'}))
{
# Read from stdin
while
(
my
$line
=
<
STDIN
>
)
{
# Chomp off newline
chomp
(
$line
);
# Process command
if
(
my
$res
=
processCommand
(
$OUT
,
$line
)
<
0
)
{
exit
1
;
if
(
defined
(
my
$file
=
$cmdline
->
{'
load-file
'}))
{
# - is a special filename used for STDIN
if
(
$file
eq
"
-
")
{
# Read from stdin - hack as we don't have a function
while
(
my
$line
=
<
STDIN
>
)
{
# Chomp off newline
chomp
(
$line
);
# Process command
if
(
my
$res
=
processCommand
(
$OUT
,
$line
)
<
0
)
{
exit
1
;
}
}
# For everything else try open the file
}
else
{
# Exit with code given by the loadFile function
exit
loadFile
(
\
*STDERR
,{
'
file
'
=>
$file
});
}
# Exit normally
exit
0
;
...
...
@@ -209,6 +216,10 @@ sub loadFile
# Reset back to beginning of file and re-read
seek
(
$FH
,
0
,
0
);
# Reset line counter (NK: UNDOCUMENTED)
$FH
->
input_line_number
(
0
);
# Loop again with each line number
my
$line_current
=
0
;
my
$percent_last
=
"";
while
(
my
$cmdline
=
<
$FH
>
)
{
...
...
Write
Preview
Supports
Markdown
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