Imported Upstream version 1.1

parents
Wed Apr 3 2013 - released v1.1
Wed Apr 3 2013 - fixes for not having color=on set in ~/.taskrc
Sun Mar 31 2013 - added <enter> for task info
Sun Mar 31 2013 - added logging error msgs when "-audit" is used
Sun Mar 31 2013 - added support for selection effects (e.g. bold)
Sun Mar 31 2013 - added setting the VIT header color via color.vit.header setting
Sat Mar 30 2013 - set the VIT header color via the color.header setting
Fri Mar 29 2013 - added support for the "inverse" and "bright" effects
Fri Mar 29 2013 - fixed parsing some ANSI underline effect escape sequences
Fri Mar 29 2013 - clear the screen before exec'ing external commands as per feature #1214
Fri Mar 29 2013 - fixed a bug where some commands (e.g. ":h") incorrectly waited after exec'ing
Fri Mar 29 2013 - added setting the default report via command line args as per feature #1216
Fri Mar 29 2013 - added support to allow for verbose=off as per topic #2851
Fri Mar 29 2013 - disallowed using a default.command which doesn't include an "ID" column
Fri Mar 29 2013 - added support for multiple effects, e.g. bold underline
Sun Mar 24 2013 - released v1.0
Sun Mar 24 2013 - added '=' for task info as per feature #1156
Sun Mar 24 2013 - added 'u' for task undo
Thu Jan 1 2013 - fixed a bug where '/' and '?' caused a crash as per bug #1152
Wed Dec 12 2012 - added graceful handling of marking only task in current report "done"
Wed Dec 12 2012 - added "blinking" of the convergence info when convergence changes
Wed Dec 12 2012 - disallowed marking completed tasks as "done"
Wed Dec 12 2012 - fixed a problem where the selection could get lost after resize and '^l'
Tue Dec 11 2012 - released v0.7
Mon Dec 10 2012 - added ./configure checks for the perl Curses and Time::HiRes modules
Mon Dec 10 2012 - added ./configure ab-end when /usr/bin/perl doesn't exist
Mon Dec 10 2012 - added ./configure substitution for the localized path to the "task" command
Sun Dec 9 2012 - fixed a problem where the selection color was lost after refresh
Sun Dec 9 2012 - added '/', '?', 'n' and 'N' for searching the current report
Sat Dec 8 2012 - added color.label to taskrc-gtk+
Fri Dec 7 2012 - added <tab> completion when using 'p' to set project
Thu Dec 6 2012 - added 'p' for setting project
Wed Dec 5 2012 - released v0.6
Wed Dec 5 2012 - added 'n' for setting priority to none
Wed Dec 5 2012 - added 'l' for setting priority to L
Wed Dec 5 2012 - added 'm' for setting priority to M
Wed Dec 5 2012 - added 'h' for setting priority to H
Tue Dec 4 2012 - added 'f' for filter the current report
Mon Dec 3 2012 - added checking of task command closing short pipe error
Mon Dec 3 2012 - added checking of task command exit status
Sun Dec 2 2012 - added 'D' for delete the current annotation (denotate)
Sat Dec 1 2012 - added 'A' for add an annotation to the current task
Sat Dec 1 2012 - added 'e' for edit current task
Sat Dec 1 2012 - fixed problems with the header attributions (bold and underline)
Fri Nov 30 2012 - released v0.5
Fri Nov 30 2012 - added ./configure (autoconf) (e.g. "./configure --prefix=/usr/local/vit")
Thu Nov 29 2012 - added support for '^w' (erase word) at the command line
Thu Nov 29 2012 - added default.command to the list of available reports
Wed Nov 28 2012 - added support for ":REPORT <filter>" syntax (e.g. ":mimimal prio:H")
Wed Nov 28 2012 - added support for the DEL key ('^?') as per bug #1134
Wed Nov 28 2012 - released v0.4
Wed Nov 28 2012 - added ":N" for move to task number N
Wed Nov 28 2012 - fixed problems with task reports that have no matches
Wed Nov 28 2012 - added ":h PATTERN" for help about PATTERN (e.g. ":h help")
Tue Nov 27 2012 - added ":h" for help
Tue Nov 27 2012 - removed the Term::ReadKey requirement
Tue Nov 27 2012 - removed xterm only requirement as per feature #1132
Tue Nov 27 2012 - fixed problems with marking the last task done
Mon Nov 26 2012 - added ":STRING<tab>" and ":<tab>" for changing the current report
Mon Nov 26 2012 - added ":REPORT" (e.g. ":long") for changing the report
Mon Nov 26 2012 - fixed problems with single tick and double quote
Mon Nov 26 2012 - released v0.3
Mon Nov 26 2012 - added support for bold and underlines ANSI colors
Sun Nov 25 2012 - wrote taskrc-gtk+
Sun Nov 25 2012 - added task-native colorization
Sat Nov 24 2012 - added ' ' for move down one line
Sat Nov 24 2012 - released v0.2
Sat Nov 24 2012 - various changes for task version 2.x
Sat Nov 24 2012 - added ":s/OLD/NEW/" for change description (e.g. ":s/opps/oops/")
Fri Nov 23 2012 - added ":q" for quit
Fri Nov 23 2012 - added 'c' for change current task
Fri Nov 23 2012 - released v0.1
Fri Nov 23 2012 - added 'a' for add task
Wed Nov 21 2012 - added 'd' for mark current task done
Tue Nov 20 2012 - added the 'G' and '0'
Mon Nov 19 2012 - added the '^f' and '^b'
Sun Nov 18 2012 - added the 'L', 'M' and 'H'
Sat Nov 17 2012 - added the 'j' and 'k'
Fri Nov 16 2012 - designed the layout
Install Instructions for VIT
----------------------------
## confugre the Makefile...
./configure
## build the script...
make
## install the script...
make install
## for GTK+ (Gnome) colors...
add the configuration strings in taskrc-gtk+ to your ~/.taskrc file
Vit is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
Foobar is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with Vit. If not, see <http://www.gnu.org/licenses/>.
CHANGES
INSTALL
LICENSE
MANIFEST
Makefile.in
README
TODO
VERSION
commands
configure
install-sh
taskrc-gtk+
args.pl
cmdline.pl
cmds.pl
color.pl
curses.pl
draw.pl
env.pl
exec.pl
getch.pl
misc.pl
prompt.pl
read.pl
screen.pl
search.pl
vit.pl
PARTS = args.pl cmdline.pl cmds.pl color.pl curses.pl draw.pl env.pl exec.pl \
getch.pl misc.pl prompt.pl read.pl search.pl screen.pl
PREFIX=@prefix@
VERSION=@VERSION@
TASK=@TASK@
PERL=@PERL@
CLEAR=@CLEAR@
.PHONY : install
build:
@echo "adding vit.pl to vit"
@cat vit.pl | grep -v ^require \
| sed "s:%prefix%:$(PREFIX):" \
| sed "s/%BUILD%/$(VERSION) built `date`/" \
| sed "s/%VERSION%/$(VERSION) (`date +%Y%m%d`)/" \
| sed "s:%TASK%:$(TASK):" \
| sed "s:%CLEAR%:$(CLEAR):" \
> vit
@for f in $(PARTS); do \
echo "adding $$f to vit"; \
echo "########################################################" >> vit; \
echo "## $$f..." >> vit; \
grep -v ^return $$f >> vit; \
done
chmod 755 vit
install:
sudo mkdir -p @prefix@/bin
sudo cp vit @prefix@/bin/vit
sudo mkdir -p @prefix@/etc/
sudo cp commands @prefix@/etc/vit-commands
autoconf:
@make -f .makefile autoconf
release:
@make -f .makefile release
push:
@make -f .makefile push
debug:
@make -f .makefile debug
test:
@make -f .makefile test
diffs:
@make -f .makefile diffs
ci:
@make -f .makefile ci
VIT - a minimalistic Taskwarrior full-screen terminal interface with Vim key bindings
Features:
Vim key bindings
uncluttered display
no mouse
speed
Requirements:
task version 2.1.2 or newer
modern ncurses (built with wide character support via --enable-widec)
the perl Curses module
Recommendations:
follow the directions in the "INSTALL" file
do "vit -help" (know the vit command line arguments)
do ":help" in vit (look over the "commands" file)
use an xterm terminal (for full color support)
for GTK+ (Gnome) colors, add the taskrc-gtk+ configuration strings to your ~/.taskrc
xterm -geom 100x40 +sb -e /usr/local/bin/vit -titlebar &
Downloads:
http://www.hep.wisc.edu/~rader/vit/
If you actually use this program, feel free to send me a msg and let me know.
steve
--
<rader@physics.wisc.edu>
director of computing
physics department
university of wisconsin
http://www.physics.wisc.edu/computing/
summary mode: improve selection by making the bar graph bar visable
summary mode: <enter> and '=' should use $default_command (currently hardcoded to "ls")
add rc for report header effects (workaround for bug #1222)
vit-1.1
sub parse_args {
while ( @ARGV ) {
if ( $ARGV[0] eq '-help' ) {
&usage();
}
if ( $ARGV[0] eq '-audit' || $ARGV[0] eq '-a' ) {
$audit = 1;
shift @ARGV;
next;
}
if ( $ARGV[0] eq '-titlebar' || $ARGV[0] eq '-t' ) {
$titlebar = 1;
shift @ARGV;
next;
}
$cli_args .= "$ARGV[0] ";
shift @ARGV;
next;
}
if ( $audit ) {
print STDERR "$$ INIT $0 " . join(' ',@ARGV), "\r\n";
}
}
#------------------------------------------------------------------
sub usage {
print "usage: vit [switches] [task_args]\n";
print " -audit print task commands to stderr\n";
print " -titlebar sets the xterm titlebar to \"$version\"\n";
print " task_args any set of task commandline args that print an \"ID\" column\n";
exit 1;
}
return 1;
sub cmd_line {
my ($prompt) = @_;
my $str = &prompt_str($prompt);
if ( $str eq '' ) {
&draw_prompt_line('');
return;
}
if ( $str =~ /^\d+$/ ) {
if ( ! defined $taskid2report[$str] ) {
$error_msg = "Error: task number $str not found";
&draw_error_msg();
return;
}
$task_selected_idx = $taskid2report[$str] - 1;
if ( $display_start_idx + $REPORT_LINES < $task_selected_idx ) {
$display_start_idx = int($task_selected_idx - $REPORT_LINES + ($REPORT_LINES / 2));
}
if ( $display_start_idx > $task_selected_idx ) {
$display_start_idx = int($task_selected_idx - $REPORT_LINES + ($REPORT_LINES / 2));
if ( $display_start_idx < 0 ) {
$display_start_idx = 0;
} elsif ( $display_start_idx > $task_selected_idx) {
$display_start_idx = $task_selected_idx;
}
}
&draw_screen();
return;
}
if ( $str =~ /^s\/(.*?)\/(.*)\/$/ || $str =~ /^%s\/(.*?)\/(.*)\/$/ ) {
my ($old,$new) = ($1,$2);
my $rtn = &task_modify("/$old/$new/");
$reread_needed = 1;
return;
}
if ( $str eq 'help' || $str eq 'h' ) {
&shell_exec("view $commands_file",'no-wait');
return;
}
if ( $str =~ /^help (.*)/ || $str =~ /^h (.*)/ ) {
my $p = $1;
my $tmp_file = "/tmp/vit-help.$$";
open(IN,"<$commands_file");
open(OUT,">$tmp_file");
print OUT "\n";
while(<IN>) {
if ( $_ =~ /$p/ ) {
print OUT $_;
}
}
close(IN);
print OUT "\n";
close(OUT);
&shell_exec("view $tmp_file",'no-wait');
unlink($tmp_file);
return;
}
if ( $str eq 'q' ) {
endwin();
exit();
}
if ( grep(/^$str$/,@report_types) ) {
$prev_command = $current_command;
$current_command = $str;
&read_report('init');
&draw_screen();
return;
}
if ( $str =~ /^(.*?) .*/ ) {
my $s = $1;
if ( grep(/^$s/,@report_types) ) {
$prev_command = $current_command;
$current_command = $str;
&read_report('init');
&draw_screen();
return;
}
}
$error_msg = "$str: command not found";
&draw_error_msg();
return;
}
return 1;
#------------------------------------------------------------------
sub task_add {
my $str = &prompt_str("Add: ");
if ( $str eq '' ) {
&draw_prompt_line('');
return;
}
my ($es,$result) = &task_exec("add \"$str\"");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
$feedback_msg = $result;
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_annotate {
my $id = $report2taskid[$task_selected_idx];
my $str = &prompt_str("Annotate: ");
if ( $str eq '' ) {
&draw_prompt_line('');
return;
}
my ($es,$result) = &task_exec("$id annotate \"$str\"");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
$feedback_msg = "Annotated task $id.";
&draw_feedback_msg();
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_denotate {
my ($ch, $str, $yes);
my $id = $report2taskid[$task_selected_idx];
for my $t (0 .. $#{ $report_tokens[$task_selected_idx] } ) {
$str .= "$report_tokens[$task_selected_idx][$t]";
}
if ( $str !~ s/^\s*\d+\/\d+\/\d+\s+// ) {
&draw_prompt_line('');
beep();
return;
}
$str =~ s/\s+$//;
$yes = &prompt_y("Delete current annotation? ");
if ( ! $yes ) {
&draw_prompt_line('');
return;
}
my ($es,$result) = &task_exec("$id denotate \"$str\"");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
$feedback_msg = "Deleted annotation.";
&draw_feedback_msg();
&flash_current_task();
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_change {
my $id = $report2taskid[$task_selected_idx];
my $str = &prompt_str("Change: ");
if ( $str eq '' ) {
&draw_prompt_line('');
return;
}
&task_modify("$str");
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_done {
my ($ch, $str, $yes);
my $id = $report2taskid[$task_selected_idx];
$yes = &prompt_y("Mark task $id done? ");
if ( ! $yes ) {
&draw_prompt_line('');
return;
}
my ($es,$result) = &task_exec("$id done");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
$feedback_msg = "Marked task done.";
&draw_feedback_msg();
&flash_current_task();
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_filter {
my ($c, $f);
if ( $current_command =~ /(.*?)\s+(.*)/ ) {
($c,$f) = ($1,$2);
} else {
$c = $current_command;
$f = '';
}
my $str = &prompt_str("Filter: $f");
if ( $str eq '' ) {
&draw_prompt_line('');
$current_command = $c;
if ( $f ne '' ) { $reread_needed = 1; }
return;
}
$prev_command = $current_command;
$current_command = "$c $str";
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_modify {
my $args = $_[0];
my $id = $report2taskid[$task_selected_idx];
my ($es,$result) = &task_exec("$id modify \"$args\"");
if ( $result =~ /Modified 0 tasks./ ) {
$error_msg = "Modifying task $id failed.";
&draw_error_msg();
return;
}
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
$feedback_msg = "Modified task $id.";
&flash_current_task();
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_set_prio {
my $p = $_[0];
my $yes;
my $id = $report2taskid[$task_selected_idx];
my $prio = &task_info('Priority');
if ( $p eq $prio ) {
beep();
return;
}
if ( $p eq '' ) {
$yes = &prompt_y("Set task ${id}'s priority to none? ");
} else {
$yes = &prompt_y("Set task ${id}'s priority to $p? ");
}
if ( ! $yes ) {
&draw_prompt_line('');
return;
}
my ($es,$result) = &task_exec("$id modify prio:$p");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
$feedback_msg = "Modified task $id.";
&flash_current_task();
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_set_project {
my $id = $report2taskid[$task_selected_idx];
my $p = &prompt_str("Project: ");
my $proj = &task_info('Project');
if ( $p eq $proj ) {
beep();
return;
}
my ($es,$result) = &task_exec("$id modify proj:$p");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
$feedback_msg = "Modified task $id.";
&flash_current_task();
$reread_needed = 1;
}
return 1;
sub parse_report_line {
my ($l,$str) = @_;
&parse_line($l,$str);
if ( $current_command eq 'summary' && $parsed_tokens[0] =~ /^(\d+) project/ ) {
$num_projects = $1;
return;
}
push @{ $report_tokens[$l] }, (@parsed_tokens);
push @{ $report_colors_fg[$l] }, (@parsed_colors_fg);
push @{ $report_colors_bg[$l] }, (@parsed_colors_bg);
push @{ $report_attrs[$l] }, (@parsed_attrs);
}
#------------------------------------------------------------------
sub parse_line {
my ($l,$str) = @_;
my $fg = 999999;
my $bg = 999999;
my $attr = '';
@parsed_tokens = ();
@parsed_colors_fg = ();
@parsed_colors_bg = ();
@parsed_attrs = ();
my @toks = split(/\x1B/,$str);
my $t = 0;
#debug("PARSE IN $str");
for my $tok (@toks) {
if ( $tok eq '' ) { next; }
$attr = '';
CASE: {
# ANSI 16 color attr pairs...
if ( $tok =~ s/\[(\d+);(\d+)m// ) {
my ($a,$b) = ($1,$2);
if ( $a > 30 ) {
$fg = $a - 30;
$bg = $b - 40;
} else {
if ( $a eq '1' ) { $attr .= 'bold '; }
if ( $b eq '4' ) { $attr .= 'underline' ; }
if ( $a eq '7' ) { $attr .= 'inverse '; }
if ( $b < 38 ) {
$fg = $b - 30;
} else {
$bg = $b - 40;
}
}
last CASE;
}
# ANSI 16 color single colors or single attrs or attrs off...
if ( $tok =~ s/\[(\d+)m// ) {
my $a = $1;
if ( $a eq '0' ) {
$fg = $bg = 999999;
$attr .= 'none ';
} elsif ( $a eq '1' ) {
$attr .= 'bold ';
} elsif ( $a eq '4' ) {
$attr .= 'underline ';
} elsif ( $a < 38 ) {
$fg = $a - 30;
$bg = 999999;
} elsif ( $a > 99 ) {
$attr .= 'standout '; # "bright" in taskwarrior
$bg = $a - 100;
$fg = 999999;
} else {
$bg = $a - 40;
$fg = 999999;
}
last CASE;
}
# ANSI 16 color bold...
if ( $tok =~ s/\[1;(\d+);(\d+)m// ) {
my ($a,$b) = ($1,$2);
$attr .= 'bold ';
$fg = $a - 30;
$bg = $b - 40;
last CASE;
}
# ANSI 16 color underline...
if ( $tok =~ s/\[4;(\d+);(\d+)m// ) {
my ($a,$b) = ($1,$2);
$attr .= 'underline ';
$fg = $a - 30;
$bg = $b - 40;
last CASE;
}
# ANSI 16 color inverse...
if ( $tok =~ s/\[7;(\d+);(\d+)m// ) {
my ($a,$b) = ($1,$2);
$attr .= 'inverse ';
$fg = $a - 30;
$bg = $b - 40;
last CASE;
}
# 256 color xterm foreground...
if ( $tok =~ s/\[38;5;(\d+)m// ) {
$fg = $1;
last CASE;
}
# 256 color xterm background...
if ( $tok =~ s/\[48;5;(\d+)m// ) {
$bg = $1;
last CASE;
}
}
# FIXME summary mode...
# if ( $tok =~ /0%\s+100%/ ) { debug("summary graph tok=\"$tok\" column=$t"); }
if ( $tok ne '' ) {
$parsed_tokens[$t] = $tok;
$parsed_colors_fg[$t] = $fg;
$parsed_colors_bg[$t] = $bg;
if ( $attr eq '' ) { $attr = 'none'; }
$parsed_attrs[$t] = $attr;
#if ( $t == 0 ) { debug("PARSE OUT tok=\"$tok\" pos=$l.$t cp=$fg,$bg attr=$attr"); }
$t++;
}
}
}
#------------------------------------------------------------------
sub extract_color {
my ($s,$t) = @_;
$parsed_colors_fg[1] = -1;
$parsed_colors_bg[1] = -1;
$parsed_attrs[1] = '';
&audit("EXEC $task rc._forcecolor=on color $s 2>&1");
open(IN2,"$task rc._forcecolor=on color $s 2>&1 |");
while(<IN2>){
if ( $_ =~ /Your sample:/ ) {
$_ = <IN2>; $_ = <IN2>;
&parse_line(0,$_);
if ( $parsed_colors_fg[1] eq '999999' ) { $parsed_colors_fg[1] = -1; }
if ( $parsed_colors_bg[1] eq '999999' ) { $parsed_colors_bg[1] = -1; }
}
}
close(IN2);
}
#------------------------------------------------------------------
return 1;
cmd a STRING add a new task
cmd A STRING add an annotation to the current task
cmd c STRING change the current task's description
cmd :s/OLD/NEW/ change OLD to NEW in the current task's description
cmd :%s/OLD/NEW/ change OLD to NEW in the current task's description
cmd D delete the current annotation (denotate)
cmd e edit the current task
cmd = view the current task's info
cmd <enter> view the current task's info
cmd u undo the last change
rpt :REPORT display REPORT
rpt :REPORT FILTER display REPORT with FILTER
rpt :STRING<tab> display REPORT using tab completion
rpt :<tab> display REPORT using tab completion of all defined reports
cmd ZZ exit
cmd :q exit
cmd f FILTER filter the current report with FILTER
cmd d mark the current task done
nav j move down one line
nav DownArrow move down one line
nav Spacebar move down one line
nav :N move to task number N
nav 0 move to the first line
nav H move to the first line on screen
nav G move to the last line
nav L move to the last line on screen
nav M move to the middle line on screen