26
25
'a|all' => \$display_all,
27
26
'e|edit' => \$mode_edit,
28
27
'h|headers' => \$display_headers,
29
'l|list' => \$mode_less,
30
's|section=s' => \$display_section,
28
'section=s' => \$display_section,
31
29
'help' => \$mode_help,
32
30
'version' => \$mode_version,
34
32
print "Try `$app_name --help' for more information.\n";
40
38
print "todo - display your todo file\n\n".
41
#01234567890123456789012345678901234567890123456789012345678901234567890123456789
42
39
"Usage: $app_name [OPTIONS]\n\n".
44
41
" -a, --all display all sections\n".
45
42
" -e, --edit edit your todo file\n".
46
43
" -h, --headers show setion headers\n".
47
" -l, --list show the list in your pager (see notes)\n".
48
" -s, --section=SECTION display sections matching the regular expression\n".
44
" --section=SECTION display this named section\n".
49
45
" --help display this help 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";
46
" --version output version information and exit\n";
66
51
if( $mode_version ) {
67
52
print "todo 1.0\n".
68
"Copyright (C) 2011, 2012 Tim Marston.\n".
53
"Copyright (C) 2011 Tim Marston.\n".
69
54
"http://ed.am/software/todo\n";
126
104
# determine editor from environment, default to "emacs -nw"
129
$editor = $ENV{ 'PAGER' };
130
defined $editor or $editor = 'less';
133
$editor = $ENV{ 'EDITOR' };
134
defined $editor or $editor = 'emacs -nw';
105
my $editor = $ENV{ 'EDITOR' };
106
defined $editor or $editor = 'emacs -nw';
136
107
my @exec_array = split( / +/, $editor );
137
108
push( @exec_array, "$todo_dir/todo" );
211
182
display_line( $last_line, $section ) if( $last_line ne '' );
214
if( ( lc( $section ) eq lc( $display_section ) ) ||
185
if( ( $section eq $display_section ) ||
215
186
( $section && $display_all ) )