Friday, March 20, 2009

a few notes from the last time I got to code

now if only I had time to do things tonight... really what I need to get done, is move much of what's left in main_loop() further into a subroutine, so I can implement source_bin() for the . / source built-ins and set it up to handle .tpsh_profile/.tpshrc files on startup through init_sh.

a few other serious things that need doing: hook our completion function into Term::ReadLine::Perl (I'm using Term::ReadLine::Zoid on my workstation; which is very easy to hook up to an app specific completion function); finish coding the completion hooks; implement `tpsh -c "cmds"`, in fact `(cmds)` could probably be expanded to that for sub-shell grouping, lol; write eval_bin(), the code needed for an eval built-in command is there, just needs the sub to bind it together; make `backquotes/backticks` needs to be handled by a pipe opened sub shell, rather then running the command directly with a pipe; and also support for an arbitrary number of pipes in commands, the place holder code in exec_pipe() only allows 'lhs | rhs'; adding ${} expansion to variable expansion, $TMPDIR works but ${TMPDIR:-/tmp} and things don't yet, but that's trivial to code.


Really the only thing that worries me, is how to implement job control :\. Setting up the built-in test command, [ which is gonna be interesting of course but actually doable, like control flow: fun but simple. The job control though, I've no freaking idea how to implement in pure Perl under unix/win32, yet...



# last stream of commits; html fixed
$ git log d59b9f864e916cd914be55b223702ec618c1ec4f..HEAD | sed 's/.../\<snip\>/g' | sed 's/.../sed@removed.it/g' | vim - 

commit 9450eca02b4dffcce6802b8fd72ba4e307ff7b9b
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 10:12:25 2009 +0000

exec and exit commands documented

Also CAVEATS & BUGS section updated about argumentless cd/chdir behaviour.

commit c24135e3748b9dbe8520b5794311af92e3affb36
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 10:06:20 2009 +0000

tpsh now exits with $? >> 8 if no exit status was given to the exit built-in

commit a9138f5991142960114f6898e7d57185eff00256
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 09:59:59 2009 +0000

cd and chdir commands documented

commit 3145e1a5672330fc913e93b3992b7c6591ff58a8
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 09:53:58 2009 +0000

CDPATH handling skipped if path starts with / or .

commit e6f8690d05308789a31fb906a28b1dbeba304ec4
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 09:20:22 2009 +0000

builtin command documented

commit b789721176eeb7d157d7c42e38044b1c111fa3dc
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 09:16:44 2009 +0000

bugfix: alias expansion turned off for builtin command

noticed that after `alias echo foo`, that `builtin echo ...` would
expand to 'builtin foo ...'

commit a6a7eeddb5309af903569aee31bb5f15ceef9d6e
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 08:46:20 2009 +0000

alias name now displays 'name' => 'definition'

Also alias expansion is now disabled on the alias command as well as
unalias. This prevents expanding the lhs (name) of an alias when name is
given, but definition is not (e.g. `alias name`)

commit 99a57b1b88d58f4ad6b318c181668cf5f5e9eeda
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 08:21:19 2009 +0000

bugfix: rhs of alias definition is no longer sh_eval()'d by alias_bin

alias_bin has ran sh_eval() before storing the macro since commit
2da5a0e38e3d14c29b0fb93ad89797826a41ddac, which was causing expansion of
things like `alias lah='ls -a $HOME' to be stored as 'lah' => 'ls -a
/home/Terry' instead of 'ls -a $HOME'; as the quotes were pre-expanded
on the command line, alias would receive and expand the environment
variable itself.

commit a9177482c3398a6272382672e45ea9d5e8254960
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 08:11:23 2009 +0000

alias built-in documented

commit 8296bb37be75e1e7c301c1ed316db13aa6c9c26d
Author: Terry <snip> <sed@removed.it>
Date: Thu Mar 19 07:34:16 2009 +0000

bugfix: SIGPIPE now handled by exec_pipe()

Previously a construct like `ls | head 1` would cause tpsh to terminate,
due to receiving an unhandled SIGPIPE on unix. tpsh now traps the signal
and will report an error if desired.

Display of the error message can be turned with the 'reportpipe' option,
which defaults to off.

commit b44b8f3b4cf6adedf972bf719f4de1546fc8a8b1
Author: Terry <snip> <sed@removed.it>
Date: Tue Mar 17 23:44:38 2009 +0000

noclobber mode is now implemented

commit 842d3a308e2663c15dc75600c19eb7f096664341
Author: Terry <snip> <sed@removed.it>
Date: Tue Mar 17 23:21:58 2009 +0000

+flag is allowed, i.e. +a

commit 289837932bf4af21c41c538e32e2d886d6f9a03b
Author: Terry <snip> <sed@removed.it>
Date: Tue Mar 17 09:26:30 2009 +0000

added set built in command and command line arguments to the manual

commit e1badaaf1e873ae0808eecb79b1b3a07219752f5
Author: Terry <snip> <sed@removed.it>
Date: Tue Mar 17 08:18:07 2009 +0000

the verbose option now works

xtrace now also prints to stderr, IAW with ash


1 comment:

  1. Originally posted on my Live Journal:

    subject:
    by: n0onz on 2009-03-20 06:26 am (UTC)
    comment: Hey, I’m just a random reader.
    Hope you don’t mind, I love your writing!
    All the best <3
    xox

    ReplyDelete