On Wed, Nov 07, 2012 at 15:13:21 GMT, Thomas Adam wrote: > Hi, > > On Tue, Nov 06, 2012 at 03:42:58PM +0900, Kazuhiko Sakaguchi wrote: >> I created and moved a pane-maximize repository on GitHub. >> https://github.com/pi8027/pane-maximize > > I took a look at this, since I'm quite keen to ensure that if this script or > one like it is to replace the current "tmux-zoom.sh" script, that it > actually works this time. > > I can't quite see how your script does work though, so I've got some > questions: > >> #!/bin/bash > > #!/usr/bin/env bash
Or, better, make it POSIX compliant. > (For those people on BSD where /bin/bash is not guaranteed.) > >> # By Kazuhiko Sakaguchi. Public domain. >> >> function usage_exit(){ >> cat <<EOT >> Usage: $(echo $0 | sed "s/.*\///") [-adP] [-F format] [-t target-pane] > > Why not using "basename" here? Also, any unrecognized parameters should just be passed to tmux for future-proofing. >> exit $1 > > I think you should just exit 1 here, and not worry about passing in some > value for this. Agreed. Plus, -1 as the return code is...odd. >> $optflag_a && nwopts="-a -t $winid $nwopts" > > It is perhaps preferrable to not treat optflag_a as some literal boolean, > but rather use something like: > > [ -n "$optflag_a" ] && nwopts="-a -t $winid $nwopts" I tend to use `true` and `false` for booleans. It's an exec either way. It also allows for some option to determing the `-a` argument in some more complex way. >> if target=$(echo $pmtable | tr : "\n" | \ >> grep -E "(=|^)$paneid(=|$)" | head -n 1 | grep .) ; then > > > Ugh. :) What is this trying to do? (I know what it's doing, it's a > rhetorical question). At this point, the "if" condition is wholly > incorrect. I suggest this: It seems to be trying to count matches. The `-q` and `-c` flags should be used instead. -- Ben ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_nov _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users