aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-06-03manual (wip)John
2019-06-03rename dwim.pl to dwimJohn
2019-06-03delete dwim symlinkJohn
2019-06-03support perl-like file + line referencesJohn
2019-06-03argument support (-d for debug)John
To facilitate debugging, I've reified the handler descriptions, which were comments previously. Now, they've been made strings passed to the `handle` subroutine, which sets `$handler`, which then (in case of -d) can be read by `fail`, which notifies the user that a handler has failed.
2019-06-01env subroutine: simpler default assignmentJohn
2019-06-01simple makefile for myselfJohn
2019-06-01dwim.plJohn
This is the Perl version of dwim. It is much easier to work with and extend, thanks to Perl's excellent regex support. The "phrase" (either $ARGV[0] or the primary X selection) is matched against regular expressions in the for loop (a primitive switch statement). This is the place to add handlers. Options are specified through environment variables, defined with default values in the section before the handlers. The `path` subroutine transforms a relative path to an absolute path based on the title of the current window. It depends on the `xtitle` program, and for it to work, you must instruct your shell (or editor) to set the terminal's title to the current directory (or currently edited file). (As such, `path` doesn't work with other programs than terminals and editors.)
2019-06-01dwim.shJohn
This is the first version of my dwim script. The problem with POSIX sh is that the case matching syntax isn't powerful enough. I need something like Perl's regex matching capabilities.