On Fri, Aug 18, 2017 at 5:53 PM, Mark Volkmann
wrote:
> I was so close!
> I had this:
> set -q language; or set language 'english'
>
> Why do I need the [1] part?
>
Because fish vars can be set but have no value. Every fish var is an array
which can have zero, one, or
I was so close!
I had this:
set -q language; or set language 'english'
Why do I need the [1] part?
On Fri, Aug 18, 2017 at 5:51 PM, Kurtis Rader wrote:
> Add this to the top of the function:
>
> set -q language[1]
> or set language english
>
> On Fri, Aug 18, 2017 at 3:25
On Fri, Aug 18, 2017 at 4:12 PM, Greg Reagle wrote:
> On Fri, Aug 18, 2017, at 18:51, Kurtis Rader wrote:
> > Add this to the top of the function:
> >
> > set -q language[1]
> > or set language english
>
> There is a potential problem with the above though. If $language is
On Fri, Aug 18, 2017, at 18:51, Kurtis Rader wrote:
> Add this to the top of the function:
>
> set -q language[1]
> or set language english
There is a potential problem with the above though. If $language is set
to the empty string, the above code will not set language to english
[1]. I say
Add this to the top of the function:
set -q language[1]
or set language english
On Fri, Aug 18, 2017 at 3:25 PM, Mark Volkmann
wrote:
> What's the best way to provide a default value for a function parameter?
> For example, suppose I have a function like this:
>
>
What's the best way to provide a default value for a function parameter?
For example, suppose I have a function like this:
function greet -a name language
switch "$language"
case 'english'
echo 'Hello, '$name
case 'spanish'
echo 'Hola, '$name
case '*'
echo