Browse Source

xml: Remove unneeded tag SUBCOMMAND

Serj Kalichev 1 year ago
parent
commit
db2836fa7b
2 changed files with 2 additions and 24 deletions
  1. 0 3
      klish.xsd
  2. 2 21
      klish/xml-helper/load.c

+ 0 - 3
klish.xsd

@@ -26,7 +26,6 @@
 	<xs:element name="ENTRY" type="entry_t"/>
 	<xs:element name="VIEW" type="view_t"/> <!-- Wrapper -->
 	<xs:element name="COMMAND" type="command_t"/> <!-- Wrapper -->
-	<xs:element name="SUBCOMMAND" type="param_t"/> <!-- Wrapper -->
 	<xs:element name="FILTER" type="command_t"/> <!-- Wrapper -->
 	<xs:element name="COND" type="command_t"/> <!-- Wrapper -->
 	<xs:element name="COMPL" type="command_t"/> <!-- Wrapper -->
@@ -282,7 +281,6 @@
 			<xs:element ref="COMPL" minOccurs="0" maxOccurs="unbounded"/>
 			<xs:element ref="HELP" 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"/>
 		</xs:choice>
 	</xs:group>
@@ -370,7 +368,6 @@
 			<xs:element ref="COMPL" minOccurs="0" maxOccurs="unbounded"/>
 			<xs:element ref="HELP" 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"/>
 		</xs:choice>
 	</xs:group>

+ 2 - 21
klish/xml-helper/load.c

@@ -80,7 +80,7 @@ static kxml_process_fn *kxml_handlers[] = {
 	process_action,
 	process_param,
 	process_param,
-	process_param,
+	process_command,
 	process_param,
 	process_command,
 	process_command,
@@ -755,27 +755,8 @@ static bool_t process_command(const kxml_node_t *element, void *parent,
 	ientry.order = "false";
 	ientry.filter = kxml_node_attr(element, "filter");
 
-	entry = ientry_load(&ientry, error);
-	if (!entry)
-		goto err;
-
-	if ((KTAG_COMMAND != parent_tag) &&
-		(KTAG_VIEW != parent_tag) &&
-		(KTAG_ENTRY != parent_tag)) {
-		faux_error_sprintf(error,
-			TAG": Tag \"%s\" can't contain COMMAND tag",
-			kxml_tag_name(parent_tag));
-		kentry_free(entry);
-		goto err;
-	}
-	if (!kentry_add_entrys(parent_entry, entry)) {
-		faux_error_sprintf(error,
-			TAG": Can't add PARAM \"%s\" to ENTRY \"%s\". "
-			"Probably duplication",
-			kentry_name(entry), kentry_name(parent_entry));
-		kentry_free(entry);
+	if (!(entry = add_entry_to_hierarchy(element, parent, &ientry, error)))
 		goto err;
-	}
 
 	if (!process_children(element, entry, error))
 		goto err;