Handling Space-separated Variables in Klish XML

56 views
Skip to first unread message

Benjamin

unread,
Oct 3, 2024, 3:07:09 AM10/3/24
to klish
In Klish XML configuration, I am trying to pass multiple space-separated values to a single variable using a PARAM tag with ptype="LIST_SPACE".
 However, only the first value is being captured, and the rest are ignored, resulting in a "Syntax error: Illegal command line" message. How can I configure Klish XML to accept a series of space-separated values and pass them into a single variable or handle them correctly?

Serj Kalichev

unread,
Oct 14, 2024, 3:53:45 AM10/14/24
to kl...@googlegroups.com
With klish version less than 3.0 you can use "args" only. The "args" is a COMMAND tag's field. It defines name for parameter that gets all the rest line arguments after parsed PARAMs. The "args" has no PTYPE so you will parse and validate it yourself.

The klish-3 has "min" and "max" fields for PARAM tag. For example "min=1 max=3" means that user must enter not less than 1 and not more than 3 values for current prameter.

On 03.10.2024 10:07, Benjamin wrote:
In Klish XML configuration, I am trying to pass multiple space-separated values to a single variable using a PARAM tag with ptype="LIST_SPACE".
 However, only the first value is being captured, and the rest are ignored, resulting in a "Syntax error: Illegal command line" message. How can I configure Klish XML to accept a series of space-separated values and pass them into a single variable or handle them correctly?
--
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 on the web visit https://groups.google.com/d/msgid/klish/b9a98bb3-ce02-432e-bc5e-5abd27eaf36fn%40googlegroups.com.


Message has been deleted

Benjamin

unread,
Feb 11, 2025, 9:58:55 AMFeb 11
to klish

Hi Serj,
Thanks for your response.

Still on this topic, I have tried using args, and it successfully captures all remaining values after the fixed PARAM.
However, I would like to have completion support for each variable.

Ex: command option1 option2 optionN..., and I can completion with tab like a suggestion for each option.

Since the number of variables is not fixed, I cannot use switch or declare multiple PARAM tags.
Is there any method to solve this issue?

Thank you.

Vào lúc 14:53:45 UTC+7 ngày Thứ Hai, 14 tháng 10, 2024, Serj Kalichev đã viết:

Serj Kalichev

unread,
Feb 11, 2025, 10:07:49 AMFeb 11
to kl...@googlegroups.com
Hi

The completion is not possible for the args.
In the same case we used multiple PARAM tags. For example ten copy-pasted PARAM tags. Why ten? Because it's rather large amount :)
Actually it's very ugly approach.
It was one of the reasons to write klish-3.
Reply all
Reply to author
Forward
0 new messages