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

Re: Local inner functions in a prompt



Hi Mikael,
 
> On 12/21/18, Eric Nielsen <eric@xxxxxxxxxxxxxxxx> wrote:
>> Hi all,
>>
>> I'm aware of https://www.zsh.org/mla/users/2011/msg00207.html and that
>> there's no such thing as an inner function.
>>
>> But I'm surprised to see that if I declare "inner" functions inside a prompt
>> function, they are not visible from "outside".
>> prompt_outer_setup() {
>>   PS1='$(prompt_outer_main)%# '
>> }
>> prompt_outer_setup
>
> You're running the function in a subshell here.

Oh, of course! (facepalm)

Do you recommend a better way to have a similar structure (one function that is called inside the prompt, that needs to call other functions), or my code structure is completely fine?

Thanks,
Eric


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