summaryrefslogtreecommitdiff
path: root/utils/cli
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-01 16:19:41 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-01 16:19:41 +0000
commit378fc51951d5e6d517717186973a892f065ca52b (patch)
treea843355408ef4608a64a351d0f97b20c7020d2a2 /utils/cli
parent41d610655d154903534fe403bd1f219580afb8c7 (diff)
Some enhancements to the CLI script wrapper
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@451 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'utils/cli')
-rw-r--r--utils/cli/ledgersmb_cli.pl18
-rw-r--r--utils/cli/sample.lsmb9
2 files changed, 18 insertions, 9 deletions
diff --git a/utils/cli/ledgersmb_cli.pl b/utils/cli/ledgersmb_cli.pl
index b689b68d..82a9785b 100644
--- a/utils/cli/ledgersmb_cli.pl
+++ b/utils/cli/ledgersmb_cli.pl
@@ -29,23 +29,31 @@ $form = new Form;
while ($line = <>){
$line =~ s/#.*//; # strip out comments
- if ($line =~ /^\s*CALL (.+) INTO (.+)/){
+ if ($line =~ /^\s*CALL\s+(.+)\s+INTO\s+(.+)/i){
$form->{$2} = &{$1}(\%$form);
- } elsif ($line =~ /^\s*MODULE (.+)/){
+ } elsif ($line =~ /^\s*MODULE (.+)/i){
$module = $1;
$module =~ s/::/\//;
eval { require $module; };
- } elsif ($line =~ /^\s*ENV:(.+)\s*=\s*(.*)/){
+ } elsif ($line =~ /^\s*ENV:(.+)\s*=\s*(.*)/i){
+ my ($key, $value) = ($1, $2);
+ $key =~ s/\s?(.*)\s?/$1/;
+ $value =~ s/\s?(.*)\s?/$1/;
$ENV{$1} = $2;
} elsif ($line =~ /^\s*(.+)\s*=\s*(.+)/){
$form->{$1} = $2;
- } elsif ($line =~ /^\s*CALL (.+)/){
- {$1}(\%$form);
+ } elsif ($line =~ /^\s*CALL\s+(.+)/i){
+ {$1};
+ } elsif ($line =~ /^\s*LOGIN\s*/i){
+ $myconfig = new LedgerSMB::User
+ "${LedgerSMB::Sysconfig::memberfile}", "$form->{login}";
} elsif ($line !~ /^\s*$/) {
die "Parse error in script file: $line";
}
}
+delete $form->{password};
+
for (keys %$form){
print "$_ = $form->{$_}\n";
}
diff --git a/utils/cli/sample.lsmb b/utils/cli/sample.lsmb
index 05650f97..62b67fb0 100644
--- a/utils/cli/sample.lsmb
+++ b/utils/cli/sample.lsmb
@@ -1,6 +1,7 @@
# THe below line shows how to set the PGUSER environment variable
-ENV:PGUSER = postgres
-user = demo # set username
-password = demo # set password
+ENV:PGUSER=postgres
+login=demo # set username
+password=demo # set password
+LOGIN
MODULE AR # load AR
-CALL AR::transactions
+CALL AR::transactions(\%$form);