[PATCH] dim: be explicit when iterating over $*
Daniel Vetter
daniel at ffwll.ch
Wed Oct 24 15:58:37 UTC 2018
On Wed, Oct 24, 2018 at 03:22:48PM +0100, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> Currently one iterates over the function arguments implicitly, via
> "for url; do ... done".
>
> Swap to using "for url in $*; do ... done", since it's tad clearer and
> obvious for some of us (ahem me).
>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Jani tends to have the useful opinions on bash style around here, I'll
leave this up to him. I'm ok either way.
-Daniel
> ---
> dim | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/dim b/dim
> index b4e63ef483a6..03847cbc3aef 100755
> --- a/dim
> +++ b/dim
> @@ -191,7 +191,7 @@ function url_to_remote # url [url ...]
> return 1
> fi
>
> - for url; do
> + for url in $*; do
> remote=$(git remote -v | grep -m 1 "$url/? (" | cut -f 1)
> if [[ -n "$remote" ]]; then
> echo "$remote"
> @@ -232,7 +232,7 @@ function pick_protocol_url # (git|ssh|https|whatever) url [url ...]
> shift
>
> # Find the URL that has given protocol
> - for url; do
> + for url in $*; do
> case $url in
> ${protocol}://*)
> protocol_url=$url
> --
> 2.19.1
>
> _______________________________________________
> dim-tools mailing list
> dim-tools at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dim-tools
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dim-tools
mailing list