palaniyappanBala / klish

Automatically exported from code.google.com/p/klish
Other
0 stars 0 forks source link

Regression 1.6.7 - Prefix (clish compatibility) doesn't work as it used to be #144

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I found a regression while switching to 1.6.7 from 1.6.6.
When using prefix="-x", -x is not set when the option is set. However, 
subcommand equivalent (as shown on the wiki) works properly.

The following XML has the two styles:
<COMMAND name="test"
        help="test">
        <DETAIL>test..
        </DETAIL>
        <PARAM name="-name"
                        help="option -name"
                        ptype="SUBCOMMAND"
                        mode="subcommand"
                        optional="true">

                        <PARAM name="name"
                                help="optional uint param"
                                ptype="UINT"/>

                </PARAM>
        <PARAM name="size"
            help="Size for LUN"
            ptype="LUN_SIZE"
            prefix="-size"/>
        <ACTION>
            echo "name"
            echo "${name}"
            echo "size"
            echo "${size}"
            echo "-name"
            echo "${-name}"
            echo "-size"
            echo "${-size}"

        </ACTION>
    </COMMAND>

Output is:
(test)> test -name 1 -size 2
name
1
size
2
-name
-name
-size

(test)>

But should be:
(test)> test -name 1 -size 2
name
1
size
2
-name
-name
-size
-size
(test)>

>What version of the product are you using? On what operating system?
I am using 1.6.7 on Debian.

>Please provide any additional information below.

The easy workaround is to use subcommand as one should do. But clish 
compatibility is broken (a good time to get rid of prefix?).
I haven't looked at the source yet for which change could be the culprit yet.

Thanks!
Co

Original issue reported on code.google.com by corent...@gmail.com on 16 Jan 2014 at 6:09

GoogleCodeExporter commented 8 years ago
It was a bug when the name field of prefixed COMMAND was the same as prefix 
field. So the subcommand and and nested param have the same names.

To fix it i have changed the internal (the real) name of subcommand. Now it has 
a special name and hidden from user.

Original comment by serj.kalichev@gmail.com on 6 Feb 2014 at 10:09