25
26
'a|all' => \$display_all,
26
27
'e|edit' => \$mode_edit,
27
28
'h|headers' => \$display_headers,
28
'section=s' => \$display_section,
29
'l|list' => \$mode_less,
30
's|section=s' => \$display_section,
29
31
'help' => \$mode_help,
30
32
'version' => \$mode_version,
32
34
print "Try `$app_name --help' for more information.\n";
38
40
print "todo - display your todo file\n\n".
41
#01234567890123456789012345678901234567890123456789012345678901234567890123456789
39
42
"Usage: $app_name [OPTIONS]\n\n".
41
44
" -a, --all display all sections\n".
42
45
" -e, --edit edit your todo file\n".
43
46
" -h, --headers show setion headers\n".
44
" --section=SECTION display this named section\n".
47
" -l, --list show the list in your pager (see notes)\n".
48
" -s, --section=SECTION display sections matching the regular expression\n".
45
49
" --help display this help and exit\n".
46
" --version output version information and exit\n";
50
" --version output version information and exit\n".
52
"Running without any options is the same as running with --section=TODO and\n".
53
"lists the default section of the todo file.\n".
55
"The advantage of using '--list' is that the pager is run as if the\n".
56
"todo list were being edited. This means that if you decide to spawn an\n".
57
"editor from you pager and edit the list, these changes get noticed.\n".
59
"The environment variables EDITOR and PAGER are used.\n".
61
"Please report bugs to Tim Marston <tim\@ed.am>.\n";
51
66
if( $mode_version ) {
52
67
print "todo 1.0\n".
53
"Copyright (C) 2011 Tim Marston.\n".
68
"Copyright (C) 2011, 2012 Tim Marston.\n".
54
69
"http://ed.am/software/todo\n";
104
126
# determine editor from environment, default to "emacs -nw"
105
my $editor = $ENV{ 'EDITOR' };
106
defined $editor or $editor = 'emacs -nw';
129
$editor = $ENV{ 'PAGER' };
130
defined $editor or $editor = 'less';
133
$editor = $ENV{ 'EDITOR' };
134
defined $editor or $editor = 'emacs -nw';
107
136
my @exec_array = split( / +/, $editor );
108
137
push( @exec_array, "$todo_dir/todo" );
182
211
display_line( $last_line, $section ) if( $last_line ne '' );
185
if( ( $section eq $display_section ) ||
214
if( ( lc( $section ) eq lc( $display_section ) ) ||
186
215
( $section && $display_all ) )