mirror of
https://github.com/weechat/weechat.git
synced 2026-07-10 03:33:12 +02:00
api: add split of string and shell arguments in evaluation of expressions
Split of string: ${split:number,separators,flags,xxx}
Split of shell arguments: ${split_shell:number,xxx}
This commit is contained in:
+24
-13
@@ -7579,24 +7579,27 @@ command_init ()
|
||||
" 8. a repeated string (format: \"repeat:count,string\")\n"
|
||||
" 9. length of a string (format: \"length:xxx\" or "
|
||||
"\"lengthscr:xxx\")\n"
|
||||
" 10. a color (format: \"color:xxx\", see \"Plugin API "
|
||||
" 10. split of a string (format: "
|
||||
"\"split:number,separators,flags,xxx\")\n"
|
||||
" 11. split of shell argmuents (format: \"split_shell:number,xxx\")\n"
|
||||
" 12. a color (format: \"color:xxx\", see \"Plugin API "
|
||||
"reference\", function \"color\")\n"
|
||||
" 11. a modifier (format: \"modifier:name,data,string\")\n"
|
||||
" 12. an info (format: \"info:name,arguments\", arguments are "
|
||||
" 13. a modifier (format: \"modifier:name,data,string\")\n"
|
||||
" 14. an info (format: \"info:name,arguments\", arguments are "
|
||||
"optional)\n"
|
||||
" 13. a base 16/32/64 encoded/decoded string (format: "
|
||||
" 15. a base 16/32/64 encoded/decoded string (format: "
|
||||
"\"base_encode:base,xxx\" or \"base_decode:base,xxx\")\n"
|
||||
" 14. current date/time (format: \"date\" or \"date:format\")\n"
|
||||
" 15. an environment variable (format: \"env:XXX\")\n"
|
||||
" 16. a ternary operator (format: "
|
||||
" 16. current date/time (format: \"date\" or \"date:format\")\n"
|
||||
" 17. an environment variable (format: \"env:XXX\")\n"
|
||||
" 18. a ternary operator (format: "
|
||||
"\"if:condition?value_if_true:value_if_false\")\n"
|
||||
" 17. result of an expression with parentheses and operators "
|
||||
" 19. result of an expression with parentheses and operators "
|
||||
"+ - * / // % ** (format: \"calc:xxx\")\n"
|
||||
" 18. a random integer number (format: \"random:min,max\")\n"
|
||||
" 19. a translated string (format: \"translate:xxx\")\n"
|
||||
" 20. an option (format: \"file.section.option\")\n"
|
||||
" 21. a local variable in buffer\n"
|
||||
" 22. a hdata name/variable (the value is automatically converted "
|
||||
" 20. a random integer number (format: \"random:min,max\")\n"
|
||||
" 21. a translated string (format: \"translate:xxx\")\n"
|
||||
" 22. an option (format: \"file.section.option\")\n"
|
||||
" 23. a local variable in buffer\n"
|
||||
" 24. 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"
|
||||
@@ -7637,6 +7640,14 @@ command_init ()
|
||||
" /eval -n ${rev:Hello} ==> olleH\n"
|
||||
" /eval -n ${repeat:5,-} ==> -----\n"
|
||||
" /eval -n ${length:test} ==> 4\n"
|
||||
" /eval -n ${split:1,,,abc,def,ghi} ==> abc\n"
|
||||
" /eval -n ${split:-1,,,abc,def,ghi} ==> ghi\n"
|
||||
" /eval -n ${split:count,,,abc,def,ghi} ==> 3\n"
|
||||
" /eval -n ${split:random,,,abc,def,ghi} ==> def\n"
|
||||
" /eval -n ${split_shell:1,\"arg 1\" arg2} ==> arg 1\n"
|
||||
" /eval -n ${split_shell:-1,\"arg 1\" arg2} ==> arg2\n"
|
||||
" /eval -n ${split_shell:count,\"arg 1\" arg2} ==> 2\n"
|
||||
" /eval -n ${split_shell:random,\"arg 1\" arg2} ==> arg2\n"
|
||||
" /eval -n ${calc:(5+2)*3} ==> 21\n"
|
||||
" /eval -n ${random:0,10} ==> 3\n"
|
||||
" /eval -n ${base_encode:64,test} ==> dGVzdA==\n"
|
||||
|
||||
Reference in New Issue
Block a user