1 |
Excerpts from Mike Frysinger's message of Sun Oct 17 23:33:57 +0200 2010: |
2 |
> On Wednesday, October 13, 2010 19:08:55 Amadeusz Żołnowski wrote: |
3 |
> > Excerpts from Mike Frysinger's message of Thu Oct 14 00:32:40 +0200 2010: |
4 |
> > > On Wednesday, October 13, 2010 18:13:18 Amadeusz Żołnowski wrote: |
5 |
> > > > Mike Frysinger's message of Wed Oct 13 23:46:43 +0200 2010: |
6 |
> > > > > On Wednesday, October 13, 2010 15:57:17 Amadeusz Żołnowski wrote: |
7 |
> > > > > > And why putting different tasks into one function? |
8 |
> > > > > |
9 |
> > > > > for the same reason we dont have separate test binaries: test_exist, |
10 |
> > > > > test_file, test_dir, etc... |
11 |
> > > > > |
12 |
> > > > > it makes more sense in my mind to combine the functionality. |
13 |
> > > > |
14 |
> > > > So the only argument for having more complicated, less intuitive and |
15 |
> > > > less readable function is the old 'test' program? Please, reconsider |
16 |
> > > > my solution with more reason. |
17 |
> > > |
18 |
> > > we prioritize differently. i prefer unified code with options. |
19 |
> > |
20 |
> > In which part it's unified? |
21 |
> |
22 |
> the file checking & status accumulation. extending my code to add more |
23 |
> options in the future is easier as well. |
24 |
|
25 |
The name doesn't allow for any sensible extension. I'd advise to change |
26 |
it to 'mtest' (which would stand for "multiple test") or something like |
27 |
that and give up default behaviour. OK, and then your /options way/ |
28 |
starts to make sense. (Although status accumulation has still no benefit |
29 |
here.) |
30 |
|
31 |
Having such an 'mtest' we might use it in following way: |
32 |
|
33 |
mtest -[oa] -[fredcw...] path1 path2 ... pathn |
34 |
|
35 |
And stil we can do it simpler: |
36 |
|
37 |
mtest() { |
38 |
local f log_op=$1 test_op=$2; shift 2 |
39 |
|
40 |
case $log_op in |
41 |
-a) for f; do |
42 |
eval "[[ $test_op '$f' ]]" || return 1 |
43 |
done |
44 |
return 0 |
45 |
;; |
46 |
-o) for f; do |
47 |
eval "[[ $test_op '$f' ]]" && return 0 |
48 |
done |
49 |
return 1 |
50 |
;; |
51 |
esac |
52 |
return -1 |
53 |
} |
54 |
|
55 |
|
56 |
– it's just a rough draft, proof of concept. You've already gone your |
57 |
way… |
58 |
|
59 |
|
60 |
> this thread is going nowhere. i believe my proposal is the way to go, and we |
61 |
> arent arguing over anything of too much value (i.e. bike shedding). no one |
62 |
> else has an opinion, so ive gone my route. |
63 |
|
64 |
|
65 |
Cheers, |
66 |
-- |
67 |
Amadeusz Żołnowski |
68 |
|
69 |
PGP key fpr: C700 CEDE 0C18 212E 49DA 4653 F013 4531 E1DB FAB5 |