Excerpts from Mike Frysinger's message of Sun Oct 17 23:33:57 +0200 2010:
> On Wednesday, October 13, 2010 19:08:55 Amadeusz Żołnowski wrote:
> > Excerpts from Mike Frysinger's message of Thu Oct 14 00:32:40 +0200 2010:
> > > On Wednesday, October 13, 2010 18:13:18 Amadeusz Żołnowski wrote:
> > > > Mike Frysinger's message of Wed Oct 13 23:46:43 +0200 2010:
> > > > > On Wednesday, October 13, 2010 15:57:17 Amadeusz Żołnowski wrote:
> > > > > > And why putting different tasks into one function?
> > > > > 
> > > > > for the same reason we dont have separate test binaries: test_exist,
> > > > > test_file, test_dir, etc...
> > > > > 
> > > > > it makes more sense in my mind to combine the functionality.
> > > > 
> > > > So the only argument for having more complicated, less intuitive and
> > > > less readable function is the old 'test' program?  Please, reconsider
> > > > my solution with more reason.
> > > 
> > > we prioritize differently.  i prefer unified code with options.
> > 
> > In which part it's unified?
> 
> the file checking & status accumulation.  extending my code to add more 
> options in the future is easier as well.

The name doesn't allow for any sensible extension.  I'd advise to change
it to 'mtest' (which would stand for "multiple test") or something like
that and give up default behaviour.  OK, and then your /options way/
starts to make sense. (Although status accumulation has still no benefit
here.)

Having such an 'mtest' we might use it in following way:

mtest -[oa] -[fredcw...] path1 path2 ... pathn

And stil we can do it simpler:

mtest() {
    local f log_op=$1 test_op=$2; shift 2
    
    case $log_op in
    -a) for f; do
            eval "[[ $test_op '$f' ]]" || return 1
        done
        return 0
        ;;
    -o) for f; do
            eval "[[ $test_op '$f' ]]" && return 0
        done
        return 1
        ;;
    esac
    return -1
}


– it's just a rough draft, proof of concept.  You've already gone your
way…


> this thread is going nowhere.  i believe my proposal is the way to go, and we 
> arent arguing over anything of too much value (i.e. bike shedding).  no one 
> else has an opinion, so ive gone my route.


Cheers,
-- 
Amadeusz Żołnowski

PGP key fpr: C700 CEDE 0C18 212E 49DA  4653 F013 4531 E1DB FAB5

Attachment: signature.asc
Description: PGP signature

Reply via email to