Upgrading to GitLab 11.10.0. Expect errors and see debian-infrastructure-announce@lists.debian.org for further information.

Commit b40f3a89 authored by Iain Learmonth's avatar Iain Learmonth

Imported Upstream version 1.2

parent a8bf0ad6
The development of Vit was made possible by the significant
contributions of the following people:
Scott Kostyshak (Maintainer and Contributing Author)
Steve Rader (Original Author)
Paul Beckingham (Advisor)
David J Patrick (Designer)
The following submitted code, packages or analysis, and deserve special thanks:
Bryce Harrington
Nemo Inis
Devendra Ghate
Thanks to the following, who submitted detailed bug reports and excellent
suggestions:
Ben Boeckel
Michael Ahern
Peter Lewis
Jean-Philippe Rutault
Jason Woofenden
Sun Apr 6 2013 - released v1.2
Tue Apr 1 2014 - the <Esc> key can now be used in shortcuts
Tue Apr 1 2014 - exit with informative error if shortcut too long (see VT-81)
Thu Mar 13 2014 - fix colors for running VIT in tmux
Sat Mar 8 2014 - do not print control characters to prompts
Thu Mar 6 2014 - fix recognition of backspace in tmux
Thu Mar 6 2014 - fix a prompt bug that prevented editing
Mon Mar 3 2014 - 'vit -audit' now creates a log with debug info
Tue Feb 4 2014 - released v1.2.beta1
Tue Feb 4 2014 - Add VIT man pages (#1284)
Mon Oct 21 2013 - Implement cursor movement in prompts (#1403)
Sun Oct 6 2013 - Clear project prompt string if escape (#1232)
Sun Oct 6 2013 - Remove confusing behavior from arrow keys in prompts (#1363)
Sun Sep 28 2013 - 'P' now sets priority and 'h', 'm', 'l', 'n' are freed (#1238)
Sun Sep 27 2013 - 'c' is renamed to 'm' (#1231)
Sun Sep 15 2013 - 't' now opens the command prompt with ":!rw task "
Sun Sep 15 2013 - shell commands can now pass the arguments VIT is using (#1338, #1237)
Sat Sep 14 2013 - custom keybinds can now be specified in ~/.vitrc (#1237, #1302, #1336)
Thu Sep 12 2013 - added ':!' to execute arbitrary string in shell
Sun Aug 12 2013 - When running an external command, VIT no longer echoes it
Sun Aug 11 2013 - VIT now cleans the terminal before exiting
Sun Aug 11 2013 - 'q' ('Q') now quits with(out) confirmation (#1266)
Thu Aug 9 2013 - fix a bug where prompt text was invisible
Mon Aug 5 2013 - 's' now runs 'task sync' if Taskwarrior >= 2.3.0 (#1301)
Sun Aug 4 2013 - when in search mode, backspace now removes a character
Sat Aug 3 2013 - 'D' now deletes a task when not over an annotation (#1230)
Sat Jul 6 2013 - added Copyright 2013, Scott Kostyshak
Sat Jul 6 2013 - added an AUTHORS file listing contributors
Sat Jul 6 2013 - 'gg' now moves to first line (#1229)
Sun Jun 23 2013 - added Copyright 2012 - 2013, Steve Rader
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
----------------------------
## configure 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.
Vit 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/>.
Copyright 2012 - 2013, Steve Rader
Copyright 2013 - 2014, Scott Kostyshak
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.1
vit.pl
vitrc.5
vitrc.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 vitrc.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@/man/man1
sudo cp vit.1 @prefix@/man/man1/
sudo mkdir -p @prefix@/man/man5
sudo cp vitrc.5 @prefix@/man/man5/
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://taskwarrior.org/projects/taskwarrior/wiki/Vit
If you actually use this program, feel free to send me a msg and let me know.
steve
--
Our friend and collaborator Steve Rader passed away in May 2013. We owe a lot
to Steve for his excellent work, and so vit is preserved, maintained and
continued.
Taskwarrior Team
support@taskwarrior.org
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.2
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
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 ) {
open(AUDIT, ">", "vit_audit.log") or die "$!";
open STDERR, '>&AUDIT';
# flush AUDIT after printing to it
my $ofh = select AUDIT;
$| = 1;
select $ofh;
print AUDIT "$$ INIT $0 " . join(' ',@ARGV), "\r\n";
}
}
#------------------------------------------------------------------
sub usage {
print "usage: vit [switches] [task_args]\n";
print " -audit print task commands to vit_audit.log\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;
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
sub cmd_line {
&audit("Inside of cmd_line");
my ($prompt) = @_;
my $str = &prompt_str($prompt);
if ( $str eq '' ) {
&draw_prompt_line('');
return;
}
if ( $str =~ /^!(.*)/ ) {
my $rtn = &shell_command($1);
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' ) {
&clean_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;
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
#------------------------------------------------------------------
sub prompt_quit {
my $yes;
$yes = &prompt_y("Quit?");
if ( ! $yes ) {
&draw_prompt_line('');
return;
}
endwin();
exit();
}
#------------------------------------------------------------------
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_den_or_del {
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]";
}
my $target = ( $str !~ s/^\s*\d+\/\d+\/\d+\s+// )
? "task"
: "annotation";
$str =~ s/\s+$//;
$yes = &prompt_y("Delete current $target? ");
if ( ! $yes ) {
&draw_prompt_line('');
return;
}
my ($es,$result) = ($target eq "annotation")
? &task_exec("$id denotate \"$str\"")
: &task_exec("$id delete rc.confirmation:no");
if ( $es != 0 ) {
$error_msg = $result;
&draw_error_msg();
return;
}
$feedback_msg = "Deleted $target.";
&draw_feedback_msg();
&flash_current_task();
$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];
&shell_exec("$task $id modify \"$args\"",'wait');
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_modify_prompt {
my $id = $report2taskid[$task_selected_idx];
my $str = &prompt_str("Modify: ");
if ( $str eq '' ) {
&draw_prompt_line('');
return;
}
&task_modify("$str");
$reread_needed = 1;
}
#------------------------------------------------------------------
sub task_set_priority {
my $id = $report2taskid[$task_selected_idx];
my $prio = &task_info('Priority');
if ( $prio eq '' ) {
$prio = 'N';
}
my $p = &prompt_chr("Change priority (l/m/h/n): ");
$p = uc($p);
if ( $p ne $prio && $p =~ /[LMHN]/ ) {
if ( $p eq 'N' ) {
$p = '';
}
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;
}
else {
&draw_prompt_line('');
return;
}
}
#------------------------------------------------------------------
sub task_set_project {
my $id = $report2taskid[$task_selected_idx];
my $p = &prompt_str("Project: ");
if ( $p eq '' ) {
&draw_prompt_line('');
return;
}
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;
}
#------------------------------------------------------------------
sub shell_command {
my $args = $_[0];
my ($opts, $cmd);
if ( $args =~ /([^ ]*) (.+)/ ) {
$opts = $1;
$cmd = $2;
}
else {
$error_msg = "Empty shell command for ':!'. See help (:h).";
&draw_error_msg();
return;
}
my $wait = "no-wait";
foreach my $l ( split //, $opts ) {
if ( $l eq 'r' ) {
$reread_needed = 1;
} elsif ( $l eq 'w' ) {
$wait = "wait";
} else {
$error_msg = "$l is not a valid command option to ':!'. See help (:h).";
&draw_error_msg();
return;
}
}
$cmd =~ s/%TASKID/$report2taskid[$task_selected_idx]/g;
$cmd =~ s/%TASKARGS/$current_command/g;
&shell_exec($cmd,"$wait");
}
return 1;
# Copyright 2012 - 2013, Steve Rader
# Copyright 2013 - 2014, Scott Kostyshak
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;