Browse Source

xsd: PARAM's aliases are SUBCOMMAND, SWITCH, MULTI

Serj Kalichev 2 years ago
parent
commit
2171177f25
1 changed files with 96 additions and 83 deletions
  1. 96 83
      klish.xsd

+ 96 - 83
klish.xsd

@@ -29,6 +29,9 @@
 	<xs:element name="DETAIL" type="detail_t"/>
 	<xs:element name="PTYPE" type="ptype_t"/>
 	<xs:element name="PARAM" type="param_t"/>
+	<xs:element name="SWITCH" type="param_t"/> <!-- PARAM alias -->
+	<xs:element name="SUBCOMMAND" type="param_t"/> <!-- PARAM alias -->
+	<xs:element name="MULTI" type="param_t"/> <!-- PARAM alias -->
 	<xs:element name="NAMESPACE" type="namespace_t"/>
 	<xs:element name="VAR" type="var_t"/>
 	<xs:element name="WATCHDOG" type="wdog_t"/>
@@ -52,20 +55,19 @@
 			</xs:documentation>
 		</xs:annotation>
 		<xs:sequence>
+			<xs:element ref="PLUGIN" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element ref="HOOK" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element ref="HOTKEY" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element ref="WATCHDOG" minOccurs="0" maxOccurs="1"/>
+			<xs:element ref="PTYPE" minOccurs="0" maxOccurs="unbounded"/>
 			<xs:element ref="OVERVIEW" minOccurs="0"/>
 			<xs:element ref="STARTUP" minOccurs="0"/>
-			<xs:element ref="PTYPE" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="COMMAND" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="VIEW" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="NAMESPACE" minOccurs="0" maxOccurs="unbounded"/>
 			<xs:element ref="VAR" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="WATCHDOG" minOccurs="0" maxOccurs="1"/>
-			<xs:element ref="HOTKEY" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="PLUGIN" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="HOOK" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element ref="VIEW" minOccurs="0" maxOccurs="unbounded"/>
 		</xs:sequence>
 	</xs:complexType>
 
+
 <!--
 *******************************************************
 * <PTYPE> is used to define the syntax for a parameter type.
@@ -78,13 +80,14 @@
 ********************************************************
 -->
 	<xs:complexType name="ptype_t">
-		<xs:attribute name="name" type="xs:string" use="required"/>
-		<xs:attribute name="help" type="xs:string" use="required"/>
 		<xs:sequence>
 			<xs:element ref="ACTION" minOccurs="0" maxOccurs="unbounded"/>
 		</xs:sequence>
+		<xs:attribute name="name" type="xs:string" use="required"/>
+		<xs:attribute name="help" type="xs:string" use="required"/>
 	</xs:complexType>
 
+
 <!--
 *******************************************************
 * <VIEW> defines the contents of a specific CLI view.
@@ -128,6 +131,7 @@
 		<xs:attribute name="access" type="xs:string" use="optional"/>
 	</xs:complexType>
 
+
 <!--
 *******************************************************
 * <STARTUP> is used to define what happens when the CLI
@@ -158,7 +162,7 @@
 	<xs:complexType name="startup_t">
 		<xs:sequence>
 			<xs:element ref="DETAIL" minOccurs="0"/>
-			<xs:element ref="ACTION" minOccurs="0"/>
+			<xs:element ref="ACTION" minOccurs="0" maxOccurs="unbounded"/>
 		</xs:sequence>
 		<xs:attribute name="view" type="xs:string" use="required"/>
 		<xs:attribute name="viewid" type="xs:string" use="optional"/>
@@ -167,61 +171,6 @@
 		<xs:attribute name="default_plugin" type="xs:boolean" use="optional" default="true"/>
 	</xs:complexType>
 
-<!--
-*******************************************************
-* <COMMAND> is used to define a command within the CLI.
-*
-* name="<string>" - A textual name for this command. (This may contain
-*	spaces e.g. "display acl")
-*
-* help="<string>" - Help for command.
-*
-* [view] - defines the view which will be transitioned to, on 
-*	successful execution of any <ACTION> tag. By default the
-*	current view stays in scope.
-*
-* [viewid] - defined the new value of the ${VIEWID} variable to
-*	be used if a transition to a new view occurs. By default
-*	the viewid will retain it's current value.
-*
-* [access] - defines the user group/level to which execution of this 
-*	command is restricted. By default there is no restriction.
-*	The exact interpretation of this field is dependant on the
-*	client of libclish but for example the clish and tclish 
-*	applications map this to the UNIX user groups.
-*
-* [escape_chars] - defines the characters which will be escaped (e.g. \$) before
-*	being expanded as a variable. By default the following
-*	characters will be escaped `|$<>&()#
-*
-* [args] - defines a parameter name to be used to gather the rest of the
-*	command line after the formally defined parameters 
-*	(PARAM elements). The formatting of this parameter is a raw
-*	string containing as many words as there are on the rest of the
-*	command line.
-*
-* [args_help] - a textual string which describes the purpose of the 'args' 
-*	parameter. If the "args" attribute is given then this MUST be
-*	given also.
-*
-********************************************************
--->
-	<xs:complexType name="command_t">
-		<xs:attribute name="name" type="xs:string" use="required"/>
-		<xs:attribute name="help" type="xs:string" use="required"/>
-		<xs:sequence>
-			<xs:element ref="DETAIL" minOccurs="0"/>
-			<xs:element ref="PARAM" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="ACTION" minOccurs="0"/>
-		</xs:sequence>
-		<xs:attribute name="ref" type="xs:string" use="optional"/>
-		<xs:attribute name="view" type="xs:string" use="optional"/>
-		<xs:attribute name="viewid" type="xs:string" use="optional"/>
-		<xs:attribute name="access" type="xs:string" use="optional"/>
-		<xs:attribute name="args" type="xs:string" use="optional"/>
-		<xs:attribute name="args_help" type="xs:string" use="optional"/>
-		<xs:attribute name="escape_chars" type="xs:string" use="optional"/>
-	</xs:complexType>
 
 <!--
 *******************************************************
@@ -285,25 +234,22 @@
 		</xs:restriction>
 	</xs:simpleType>
 
-	<xsd:group name="param_group_t">
-		<xsd:choice minOccurs="0" maxOccurs="unbounded">
-			<xs:element ref="PARAM" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="SWITCH" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="SUBCOMMAND" minOccurs="0" maxOccurs="unbounded"/>
-			<xs:element ref="MULTI" minOccurs="0" maxOccurs="unbounded"/>
-		</xsd:choice>
-	</xsd:group>
-
-	<!--  Permit any of these tags in any order in any number     -->
-	<xsd:choice minOccurs="0" maxOccurs="unbounded">
-
+	<xs:group name="param_group_t">
+		<xs:choice>
+			<xs:element ref="PARAM"/>
+			<xs:element ref="SWITCH"/>
+			<xs:element ref="SUBCOMMAND"/>
+			<xs:element ref="MULTI"/>
+		</xs:choice>
+	</xs:group>
 
 	<xs:complexType name="param_t">
-		<xs:attribute name="name" type="xs:string" use="required"/>
-		<xs:attribute name="help" type="xs:string" use="required"/>
+		<!--  Any order of tags and any number -->
 		<xs:sequence>
-			<xs:element ref="PARAM" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:group ref="param_group_t" minOccurs="0" maxOccurs="unbounded"/>
 		</xs:sequence>
+		<xs:attribute name="name" type="xs:string" use="required"/>
+		<xs:attribute name="help" type="xs:string" use="required"/>
 		<xs:attribute name="ptype" type="xs:string" use="required"/>
 		<xs:attribute name="default" type="xs:string" use="optional"/>
 		<xs:attribute name="prefix" type="xs:string" use="optional"/>
@@ -317,6 +263,7 @@
 		<xs:attribute name="access" type="xs:string" use="optional"/>
 	</xs:complexType>
 
+
 <!--
 ********************************************************
 * <ACTION> specifies the action to be taken for
@@ -372,6 +319,65 @@
 		</xs:simpleContent>
 	</xs:complexType>
 
+
+<!--
+*******************************************************
+* <COMMAND> is used to define a command within the CLI.
+*
+* name="<string>" - A textual name for this command. (This may contain
+*	spaces e.g. "display acl")
+*
+* help="<string>" - Help for command.
+*
+* [view] - defines the view which will be transitioned to, on 
+*	successful execution of any <ACTION> tag. By default the
+*	current view stays in scope.
+*
+* [viewid] - defined the new value of the ${VIEWID} variable to
+*	be used if a transition to a new view occurs. By default
+*	the viewid will retain it's current value.
+*
+* [access] - defines the user group/level to which execution of this 
+*	command is restricted. By default there is no restriction.
+*	The exact interpretation of this field is dependant on the
+*	client of libclish but for example the clish and tclish 
+*	applications map this to the UNIX user groups.
+*
+* [escape_chars] - defines the characters which will be escaped (e.g. \$) before
+*	being expanded as a variable. By default the following
+*	characters will be escaped `|$<>&()#
+*
+* [args] - defines a parameter name to be used to gather the rest of the
+*	command line after the formally defined parameters 
+*	(PARAM elements). The formatting of this parameter is a raw
+*	string containing as many words as there are on the rest of the
+*	command line.
+*
+* [args_help] - a textual string which describes the purpose of the 'args' 
+*	parameter. If the "args" attribute is given then this MUST be
+*	given also.
+*
+********************************************************
+-->
+	<xs:complexType name="command_t">
+		<xs:sequence>
+			<xs:element ref="DETAIL" minOccurs="0"/>
+			<!--  Any order of PARAM tags and any number -->
+			<xs:group ref="param_group_t" minOccurs="0" maxOccurs="unbounded"/>
+			<xs:element ref="ACTION" minOccurs="0" maxOccurs="unbounded"/>
+		</xs:sequence>
+		<xs:attribute name="name" type="xs:string" use="required"/>
+		<xs:attribute name="help" type="xs:string" use="required"/>
+		<xs:attribute name="ref" type="xs:string" use="optional"/>
+		<xs:attribute name="view" type="xs:string" use="optional"/>
+		<xs:attribute name="viewid" type="xs:string" use="optional"/>
+		<xs:attribute name="access" type="xs:string" use="optional"/>
+		<xs:attribute name="args" type="xs:string" use="optional"/>
+		<xs:attribute name="args_help" type="xs:string" use="optional"/>
+		<xs:attribute name="escape_chars" type="xs:string" use="optional"/>
+	</xs:complexType>
+
+
 <!--
 ********************************************************
 * <OVERVIEW> specifies a textual description of the shell.
@@ -387,6 +393,7 @@
 		</xs:restriction>
 	</xs:simpleType>
 
+
 <!--
 ********************************************************
 * <DETAIL> specifies a textual description.
@@ -409,6 +416,7 @@
 		</xs:restriction>
 	</xs:simpleType>
 
+
 <!--
 *******************************************************
 * <NAMESPACE> import commands from specific view to current view.
@@ -446,6 +454,7 @@
 		<xs:attribute name="access" type="xs:string" use="optional"/>
 	</xs:complexType>
 
+
 <!--
 *******************************************************
 * <VAR> Specify the variable.
@@ -456,7 +465,7 @@
 -->
 	<xs:complexType name="var_t">
 		<xs:sequence>
-			<xs:element ref="ACTION" minOccurs="0"/>
+			<xs:element ref="ACTION" minOccurs="0" maxOccurs="unbounded"/>
 		</xs:sequence>
 		<xs:attribute name="name" type="xs:string" use="required"/>
 		<xs:attribute name="help" type="xs:string" use="optional"/>
@@ -464,6 +473,7 @@
 		<xs:attribute name="dynamic" type="xs:boolean" use="optional" default="false"/>
 	</xs:complexType>
 
+
 <!--
 *******************************************************
 * <WATCHDOG> is used to recover system after errors.
@@ -472,10 +482,11 @@
 -->
 	<xs:complexType name="wdog_t">
 		<xs:sequence>
-			<xs:element ref="ACTION" minOccurs="1"/>
+			<xs:element ref="ACTION" minOccurs="1" maxOccurs="unbounded"/>
 		</xs:sequence>
 	</xs:complexType>
 
+
 <!--
 *******************************************************
 * <HOTKEY> is used to define hotkey actions
@@ -487,6 +498,7 @@
 		<xs:attribute name="cmd" type="xs:string" use="required"/>
 	</xs:complexType>
 
+
 <!--
 *******************************************************
 * <PLUGIN> is used to dynamically load plugins.
@@ -509,6 +521,7 @@
 		</xs:simpleContent>
 	</xs:complexType>
 
+
 <!--
 *******************************************************
 * <HOOK> is used to redefine internal hooks