Support variables in abbr value
eric2323223 opened this issue · comments
Hi, I think it wil ge great to support variable evaluation when expanding abbreviation.
For example:
Given password=mysecret
abbr cflogin='cf login -p ${password} -o myOrg -s mySpace'
Thanks for writing this up!
Your specific example should work if you use double quotation marks "
.
% password=mysecret
% abbr cflogin="cf login -p $password -o myOrg -s mySpace"
Let me know if that doesn't work.
For more generally supporting placeholders, the best solution I've thought of is xargs. There are some examples in #21. If you end up doing something like that let me know, I'm always interested to see advanced things people get up to with abbreviations.
Unasked for security advice: I don't use cf but if not providing a password (cf login -o myOrg -s mySpace
) will prompt you to interactively enter one, that's going to be safer — no chance of it getting into your zsh history, and no chance of someone seeing it over your shoulder.
Thank you very much
You're welcome! saw the first response too, you're totally right double quotes aren't going to give you your end goal. It's an interesting problem, but I don't think zsh-abbr will be the answer.