Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 1/1] Squashed commit of the following:



Doron Behar wrote:
> The idea with the 1st condition that tests the existence of the
> manifests files, is that if non of them exists (which usually never
> happens if luarocks is installed properly), is that only one of them is
> needed for continuing with the modification date of them vs the cache
> file..

Okay, that makes sense.

> 	local cache_status=1
> 	if [[ -f ${cache_file} ]]; then
> 	  if [[ -f ${user_manifest_file} ]]; then
> 	    if [[ ${user_manifest_file} -nt ${cache_file} ]]; then
> 	      cache_status=0
> 	    fi
> 	  fi
> 	  if [[ -f ${system_manifest_file} ]]; then
> 	    if [[ ${system_manifest_file} -nt ${cache_file} ]]; then
> 	      cache_status=0
> 	    else
> 	      cache_status=1

As you've initialised cache_status to 1, this else branch is
superfluous.

> 	    fi
> 	  fi
> 	fi
> 	return cache_status
>
> Better?

Yes. Much more readable.

I look forward to the final function.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author