Skip to content

Commit

Permalink
Add option: --with-preamble
Browse files Browse the repository at this point in the history
  • Loading branch information
perlancar committed Jan 3, 2015
1 parent 724464b commit be18757
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/App/FilterOrgByHeadlines.pm
Expand Up @@ -113,6 +113,13 @@ _
"Don't include headline content, just print the headlines",
default => 1,
},
with_preamble => {
schema => 'bool',
summary => 'Include text before any headline',
'summary.alt.bool.not' =>
"Don't include text before any headline",
default => 1,
},
},
result_naked => 1,
result => {
Expand All @@ -122,8 +129,9 @@ _
sub filter_org_by_headlines {
my %args = @_;

my $input = $args{input};
my $with_ct = $args{with_content} // 1;
my $input = $args{input};
my $with_ct = $args{with_content} // 1;
my $with_pre = $args{with_preamble} // 1;

my $curhl;
my $curlevel;
Expand Down Expand Up @@ -177,7 +185,7 @@ sub filter_org_by_headlines {
my $include;
FILTER: {
if (!$curhl) {
$include++;
$include++ if $with_pre;
last FILTER;
}
last if !$with_ct && !$is_hl;
Expand Down

0 comments on commit be18757

Please sign in to comment.