Commit ff1dfebe authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Merge branch 'nkloadfile' into 'master'

Better support for loading files with progress indicator

See merge request !14
parents 15aa0af0 d8505760
......@@ -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
......
......@@ -42,7 +42,7 @@ GetOptions(
"connect=s",
"stdin",
"load-file=s",
"help"
);
......
......@@ -150,13 +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) {
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
if (loadFile(\*STDERR,"file='$file'") < 0) {
exit 1;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment