1 |
On Sun, 8 May 2016 11:20:34 -0400 |
2 |
Michael Orlitzky <mjo@g.o> wrote: |
3 |
|
4 |
> On 05/07/2016 04:13 PM, James Le Cuirot wrote: |
5 |
> > |
6 |
> > + if [[ $(tr -s "[:space:]" "\n" <<< "${PLOCALES}" | sort | |
7 |
> > xargs echo) != ${current%[[:space:]]} ]] ; then |
8 |
> |
9 |
> The stuff on the left-hand side just sorts a space-separated list, |
10 |
> right? It might be time to split that into another function. It looks |
11 |
> a lot less insane when it's, |
12 |
> |
13 |
> if [[ $(l10n_sort_spaces "${PLOCALES}") != ${current%[[:space:]]} ]] |
14 |
> |
15 |
> Then the function would just be |
16 |
> |
17 |
> # @FUNCTION: l10n_sort_spaces |
18 |
> # @DESCRIPTION: |
19 |
> # Takes a space-separated list of strings as an argument and sorts |
20 |
> # them. The output is again space-separated. This is accomplished |
21 |
> # by first replacing the spaces with newlines so that "sort" can |
22 |
> # be used, and then collecting the output back onto one line. |
23 |
> function l10n_sort_spaces() { |
24 |
> tr -s "[:space:]" "\n" <<< "${1}" | sort | xargs echo |
25 |
> } |
26 |
> |
27 |
> You should also document why you're doing that nearby, since like you |
28 |
> said, the eclass assumes that PLOCALES is sorted. Someone will wonder |
29 |
> why you're doing it again. |
30 |
|
31 |
I feel an extra function for something we're only doing once is a bit |
32 |
redundant. I was happy to add a short explanation though so I did that. |
33 |
Merged it now. |
34 |
|
35 |
-- |
36 |
James Le Cuirot (chewi) |
37 |
Gentoo Linux Developer |