1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 17:23:15 +02:00

core: add ternary operator (condition) in evaluation of expressions

This commit is contained in:
Sébastien Helleu
2017-03-04 19:41:23 +01:00
parent 07d16903f3
commit 83117f8d2a
10 changed files with 293 additions and 110 deletions
+16 -13
View File
@@ -7273,9 +7273,11 @@ command_init ()
"optional)\n"
" 6. current date/time (format: \"date\" or \"date:format\")\n"
" 7. an environment variable (format: \"env:XXX\")\n"
" 8. an option (format: \"file.section.option\")\n"
" 9. a local variable in buffer\n"
" 10. a hdata name/variable (the value is automatically converted "
" 8. a ternary operator (format: "
"if:condition?value_if_true:value_if_false)\n"
" 9. an option (format: \"file.section.option\")\n"
" 10. a local variable in buffer\n"
" 11. a hdata name/variable (the value is automatically converted "
"to string), by default \"window\" and \"buffer\" point to current "
"window/buffer.\n"
"Format for hdata can be one of following:\n"
@@ -7295,16 +7297,17 @@ command_init ()
"reference\", function \"weechat_hdata_get\".\n"
"\n"
"Examples (simple strings):\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"
" /eval -n ${window} ==> 0x2549aa0\n"
" /eval -n ${window.buffer} ==> 0x2549320\n"
" /eval -n ${window.buffer.full_name} ==> core.weechat\n"
" /eval -n ${window.buffer.number} ==> 1\n"
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${info:version} ==> 0.4.3\n"
" /eval -n ${env:HOME} ==> /home/user\n"
" /eval -n ${weechat.look.scroll_amount} ==> 3\n"
" /eval -n ${window} ==> 0x2549aa0\n"
" /eval -n ${window.buffer} ==> 0x2549320\n"
" /eval -n ${window.buffer.full_name} ==> core.weechat\n"
" /eval -n ${window.buffer.number} ==> 1\n"
" /eval -n ${\\t} ==> <tab>\n"
" /eval -n ${hide:-,${relay.network.password}} ==> --------\n"
" /eval -n ${date:%H:%M:%S} ==> 07:46:40\n"
" /eval -n ${if:${info:term_width}>80?big:small} ==> big\n"
"\n"
"Examples (conditions):\n"
" /eval -n -c ${window.buffer.number} > 2 ==> 0\n"