Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support for [% system %] command

Signed-off-by: Moritz Lenz <moritz@faui2k3.org>
  • Loading branch information...
commit 55d76b81ea262f9bdd84498b2f95c4506f46e77d 1 parent 9714777
Stefan Schröder authored committed
Showing with 16 additions and 1 deletion.
  1. +16 −1 lib/Mowyw.pm
View
17 lib/Mowyw.pm
@@ -53,6 +53,7 @@ my @input_tokens = (
[ 'KEYWORD', qr/(?:
include
|menu
+ |system
|option
|item
|endverbatim
@@ -103,6 +104,7 @@ sub parse_all_in_dir {
}
closedir DIR;
}
+ print STDERR "Processed $processed_files_count files in total.\n";
}
sub process_dir {
@@ -187,6 +189,16 @@ sub p_include {
return parse_file($fn, $m);
}
+# parse sub: parse a system statement.
+sub p_system {
+ my $tokens = shift;
+ my $meta = shift;
+ my $fn = strip_ws(slurp_upto_token($tokens, 'TAG_END', $meta));
+ print STDERR "Executing external command '$fn'\n" ; #unless $Quiet;
+ my $tmp = `$fn`;
+ return ($tmp);
+}
+
# parse sub: parse a 'menu' statement.
# note that TAG_START and the keyword "menu" are already stripped
sub p_menu {
@@ -636,6 +648,7 @@ sub parse_tokens {
my %dispatch = (
include => \&p_include,
+ system => \&p_system,
menu => \&p_menu,
item => \&p_item,
option => \&p_option,
@@ -743,7 +756,9 @@ sub process_file {
if ($config{make_behaviour} and -e $new_fn and (stat($fn))[9] < (stat($new_fn))[9]){
return;
}
- print STDERR "Processing File '$fn'..." unless $config{quiet};
+ print STDERR "Processing File '$fn'..." unless $Quiet;
+ $processed_files_count++;
+
my $metadata = get_meta_data($fn);
push @{$metadata->{FILES}}, $fn;
Please sign in to comment.
Something went wrong with that request. Please try again.