--
You received this message because you are subscribed to the Google Groups "klish" group.
To unsubscribe from this group and stop receiving emails from it, send an email to klish+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/klish/a03ffce2-c8cc-4d7e-8656-b3c7436a0aaan%40googlegroups.com.
But I'm not sure if I can do it quickly.
To view this discussion visit https://groups.google.com/d/msgid/klish/23b82ef5-e132-48ed-af91-029d226f4f8en%40googlegroups.com.
Hi Serj!Thank you very much for the quick solution and many thanks for your wonderful project!
I'm testing Klish 3 now and I see that the STRING type doesn't accept any parameters. Are there any plans to improve it? I guess it could accept a list of valid string variables, for example )
Have a nice day!
вт, 10 июн. 2025 г., 22:19 Serj Kalichev <serj.k...@gmail.com>:Hi, Aleksander
I have implemented environment variable for whole line named KLISH_LINE.The variables like KLISH_PARAM_comment now contain all values for multi-value parameters.It's not necessary to compose such string by hands.
Try it from klish 3 git repository https://klish.libcode.org. If all is ok I will probably release a new version.
04.06.2025 16:48, Aleksander Djuric пишет:
To view this discussion visit https://groups.google.com/d/msgid/klish/23b82ef5-e132-48ed-af91-029d226f4f8en%40googlegroups.com.
Hi, Thanks!
It would be wonderful. I think it might look something like this:<ACTION sym="STRING">one two three *</ACTION> or
<ACTION sym="STRING">*:0 one:1 two:2 three:3</ACTION>Please look at some of the workarounds I use without these string types. It's real cases from my tests. Hope it can be helpful:
1. String type for systemd time format (regex):
<PTYPE name="TIME" help="Time stamp">
<COMPL>
<ACTION sym="script">/usr/bin/date +%T</ACTION>
</COMPL>
<ACTION sym="script">[[ "$KLISH_VALUE" =~ ^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]$ ]]</ACTION>
</PTYPE>2. String type for systemd date tokens (restricted set of values):
<PTYPE name="TOKEN" help="Special date token">
<COMPL>
<ACTION sym="printl">now</ACTION>
<ACTION sym="printl">today</ACTION>
<ACTION sym="printl">tomorrow</ACTION>
<ACTION sym="printl">yesterday</ACTION>
</COMPL>
<ACTION sym="script" exec_on="fail">[[ "$KLISH_VALUE" =~ ^(now|today|tomorrow|yesterday)$ ]]</ACTION>
</PTYPE>
3. Journald message priority (restricted set of values with replacement)
<PTYPE name="PRIORITY" help="Message priority">
<COMPL>
<ACTION sym="printl">emergency</ACTION>
<ACTION sym="printl">alerts</ACTION>
<ACTION sym="printl">critical</ACTION>
<ACTION sym="printl">errors</ACTION>
<ACTION sym="printl">warning</ACTION>
<ACTION sym="printl">notice</ACTION>
<ACTION sym="printl">info</ACTION>
<ACTION sym="printl">debug</ACTION>
</COMPL>
<ACTION sym="script">
case "$KLISH_VALUE" in
emergency ) echo -n 0 ;;
alerts ) echo -n 1 ;;
critical ) echo -n 2 ;;
errors ) echo -n 3 ;;
warning ) echo -n 4 ;;
notice ) echo -n 5 ;;
info ) echo -n 6 ;;
debug ) echo -n 7 ;;
* ) return 1 ;;
esac
</ACTION>
</PTYPE>
Regards,
ср, 11 июн. 2025 г. в 08:57, Serj Kalichev <serj.k...@gmail.com>: