Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Global array actually not available
- X-seq: zsh-users 21713
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Global array actually not available
- Date: Thu, 30 Jun 2016 16:34:55 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=n0CvckqlTlNwQTi7uF9LCz2JEFvLLn8XRLYb5PR2cq0=; b=oE04g3Rjyn04TToZbjuo0Wjz707Nn7Ea3FHv8eGKRZrHQn9YVLXcSuMkfSt7LYRHzO nPmF8ABUK1QXZzDojRsUtvef9LJ8Hkz72Sv56qaDpQpgsfGiIxGNxtcqPGtxEvwvwA67 d2fKDRPHMkX2wXQVKwyGHUlbCJvEb4pCx92uqb8LPe2/5A+ThbEdKdi8+O+a7kkUD2KQ 5H2ydgZuyQo6/tcf03rA33zVvY6msJn7g15VFD97yEmpt8owUFoET7Z4qlpXzzXEnLPP LUAx5lbaLSN9AlFqJhJbgr4Eb5742QkJ/c1xQBMVHBnLnPocoTUbsYP4Kh6C+WhNih5S hWDQ==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Hello
In code, I declare reply2 and reply3 as arrays via typeset -ga. I do
this from inside of a function. When the code returns to outer scope,
(t)reply2 and (t)reply3 show empty strings. The following lines start
at line 293 in lib/script_functions:
typeset -ga reply2 reply3
echo "T1 ${(t)reply} T2 ${(t)reply2} T3 ${(t)reply3}"
reply=( "${existing[@]}" )
reply2=( "${files[@]}" )
reply3=( "${sections[@]}" )
This is inner scope. The outer scope (line 1148 in zsh-select-zekyll) does:
filter_for_existing_zekylls "${zekylls[@]}"
three_to_section_order "${#reply}" "${reply[@]}" "${reply2[@]}"
"${reply3[@]}"
echo "t1 ${(t)reply} t2 ${(t)reply2} t3 ${(t)reply3}"
local -a existing files sections
existing=( "${reply[@]}" )
files=( "${reply2[@]}" )
sections=( "${reply3[@]}" )
echo "existing count: ${#existing}, files count: ${#files},
sections count: ${#sections}"
t1-t3 show empty string. Assigning ${reply2[@]} to files=( ... ) cause
the variable files to contain one mysterious element – it is empty,
probably.
To run the code first download zekyll, the investigation branch:
https://github.com/psprint/zekyll/tree/investig
it has to be unpacked to ~/.zekyll, final directory "zekyll", so full
path ~/.zekyll/zekyl. One can also use install script:
wget https://github.com/psprint/zekyll/blob/master/install.sh
sh ./install.sh
Next, one also needs a zkl repository available under
~/.zekyll/repos/{the-zkl-repo} or somewhere else (the path below after
-mp must match). It can be downloaded from:
https://github.com/psprint/zkl
After that, simply run command:
zkview -mp "/Users/sgniazdowski/github/zkl.git" --zkl
aaaaabaacaadaaeaafaagaahaaiaajaakaalaamaanaaoaap
Errorneous output will be created:
Read: aaaaabaacaadaaeaafaagaahaaiaajaakaalaamaanaaoaap
Checking current zekyll for duplicates...
T1 T2 array T3 array
-> aaa.A--Mainly_Exports
-> aab.A--Setopts_all
-> aad.B--Autoloads_tools_binds
-> aac.C--Bindkeys
-> aaf.D--Old_functions
-> aae.E--Aliases_all
-> aag.F--Tools_functions
-> aah.F--Other_functions
-> aaj.F--Off
-> aai.G--Hack
-> aak.H--Zplugin
-> aal.H--Zsh_navigation_tools
-> aam.I--Zstyles
-> aap.J--Completion
-> aan.K--Prompt_selection_final_setup
-> aao.L--Very_final
t1 t2 t3
existing count: 1, files count: 1, sections count: 1
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author