CN111143006A - Method and device for acquiring command help information - Google Patents

Method and device for acquiring command help information Download PDF

Info

Publication number
CN111143006A
CN111143006A CN201911359852.9A CN201911359852A CN111143006A CN 111143006 A CN111143006 A CN 111143006A CN 201911359852 A CN201911359852 A CN 201911359852A CN 111143006 A CN111143006 A CN 111143006A
Authority
CN
China
Prior art keywords
help
command
information
field
function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911359852.9A
Other languages
Chinese (zh)
Other versions
CN111143006B (en
Inventor
刘积磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201911359852.9A priority Critical patent/CN111143006B/en
Publication of CN111143006A publication Critical patent/CN111143006A/en
Application granted granted Critical
Publication of CN111143006B publication Critical patent/CN111143006B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • G06F9/453Help systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Input From Keyboards Or The Like (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The invention provides a method and a device for acquiring command help information, which can reduce code redundancy and improve code maintainability. The acquisition method of the command help information comprises the following steps: when a first command carrying a help identifier is received, the help identifier is located in a first field of the first command, target command information matched with the first command is found from registered command information, and the target command information at least comprises: a field identification of the first field; determining a transfer parameter at least containing a field identifier in the target command information; and calling a help function corresponding to the first command and inputting the transfer parameter to the help function so as to obtain help information corresponding to the transfer parameter by the help function, wherein the help function corresponds to a plurality of commands.

Description

Method and device for acquiring command help information
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for acquiring command help information.
Background
The command line is a tool for the administrator to operate, such as configure, the network, and most of the commands are a string expression formed by combining a plurality of keywords and parameters in a certain order. In one command, the key is fixed and the parameter is variable. For example, in the command "no ip address 192.168.0.1/16", no "," ip "and" address "are all keywords, and" 192.168.0.1/16 "is a parameter.
A large number of commands are difficult to memorize, and the difficulty of operation of an administrator is increased. Help functions in the command line may help alleviate operational difficulties, and a user may be able to identify such as by help when forgetting a partial keyword or parameter of a command, such as "? The help information of the command can be acquired, the help information can be used for supplementing the command or prompting subsequent parameters, and the operation efficiency of a user can be improved.
Generally, there is a one-to-one relationship between a command and a help function, and when help information of a command is obtained through a help identifier, the help function corresponding to the command is called, and the help information of the command is output by the help function. In the mode, one help function can only be used by one command, and the code redundancy is high and the maintainability is low.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for obtaining command help information, which can reduce code redundancy and improve code maintainability.
The first aspect of the present invention provides a method for acquiring command help information, including:
when a first command carrying a help identifier is received, the help identifier is located in a first field of the first command, target command information matched with the first command is found from registered command information, and the target command information at least comprises: a field identification of the first field;
determining a transfer parameter at least containing a field identifier in the target command information;
and calling a help function corresponding to the first command and inputting the transfer parameter to the help function so as to obtain help information corresponding to the transfer parameter by the help function, wherein the help function corresponds to a plurality of commands.
According to an embodiment of the present invention, determining a delivery parameter at least containing a field identifier in the target command information includes:
when the first command carries parameters, acquiring the parameters in the first command;
and determining the acquired parameters, the number of the parameters and the field identification in the target command information as the transfer parameters.
In accordance with one embodiment of the present invention,
the target command information further includes: the help type corresponding to the first field;
before determining the transfer parameter at least containing the field identifier in the target command information, the method further comprises:
checking whether the help type in the target command information is a dynamic help type, wherein the dynamic help type refers to a help type with variable content on a corresponding field;
if yes, the step of determining the transfer parameter at least containing the field identification in the target command information is continuously executed.
In accordance with one embodiment of the present invention,
the target command information further includes: function call information corresponding to the first command;
calling a help function corresponding to the first command, wherein the calling comprises:
and calling a help function corresponding to the first command according to the function calling information in the target command information.
According to an embodiment of the present invention, after the help function corresponding to the first command is called and the transfer parameter is input to the help function, the method further includes:
acquiring help information recorded by a help information data structure corresponding to a first field, wherein the help information data structure corresponding to the first field is created for the first field when the help function is called;
and replacing the help identification in the first command with the acquired help information in the display interface where the first command is located.
According to an embodiment of the invention, the method further comprises:
when a second command which does not carry a help identification is received, if a second field with a field type being an interface index type exists in the second command, determining an index value corresponding to an interface name on the second field from help information recorded by a help information data structure corresponding to the created second field, and executing the second command according to the index value.
A second aspect of the present invention provides an apparatus for acquiring command help information, including:
a command matching module, configured to, when a first command carrying a help identifier is received, locate the help identifier in a first field of the first command, and find target command information that matches the first command from registered command information, where the target command information at least includes: a field identification of the first field;
a transfer parameter determining module, configured to determine a transfer parameter at least including a field identifier in the target command information;
and the help information acquisition module is used for calling a help function corresponding to the first command and inputting the transfer parameter to the help function so as to acquire help information corresponding to the transfer parameter by the help function, wherein the help function corresponds to a plurality of commands.
According to an embodiment of the present invention, when the transfer parameter determining module determines the transfer parameter at least including the field identifier in the target command information, the transfer parameter determining module is specifically configured to:
when the first command carries parameters, acquiring the parameters in the first command;
and determining the acquired parameters, the number of the parameters and the field identification in the target command information as the transfer parameters.
In accordance with one embodiment of the present invention,
the target command information further includes: the help type corresponding to the first field;
before the transfer parameter determining module determines the transfer parameter at least containing the field identifier in the target command information, the transfer parameter determining module is further configured to:
checking whether the help type in the target command information is a dynamic help type, wherein the dynamic help type refers to a help type with variable content on a corresponding field;
if yes, the step of determining the transfer parameter at least containing the field identification in the target command information is continuously executed.
In accordance with one embodiment of the present invention,
the target command information further includes: function call information corresponding to the first command;
when the help information obtaining module calls the help function corresponding to the first command, the help information obtaining module is specifically configured to:
and calling a help function corresponding to the first command according to the function calling information in the target command information.
According to an embodiment of the present invention, after the help information obtaining module invokes the help function corresponding to the first command and inputs the transfer parameter to the help function, the help information obtaining module is further configured to:
acquiring help information recorded by a help information data structure corresponding to a first field, wherein the help information data structure corresponding to the first field is created for the first field when the help function is called;
and replacing the help identification in the first command with the acquired help information in the display interface where the first command is located.
According to an embodiment of the invention, the apparatus further comprises:
an index value determining module, configured to, when a second command that does not carry a help identifier is received, if a second field whose field type is an interface index type exists in the second command, determine an index value corresponding to an interface name in a created help information corresponding to a help information data structure record of the second field, and execute the second command according to the index value.
The embodiment of the invention has the following beneficial effects:
in the embodiment of the invention, one help function can correspond to a plurality of commands, when a first command carrying help identification is received, target command information matched with the first command can be found from registered command information, the target command information at least comprises field identification of a first field where the help identification is located, the help function corresponding to the first command is called, the field identification is used as a transfer parameter and is input into the help function, and the help function can obtain the help information corresponding to the transfer parameter.
Drawings
FIG. 1 is a flowchart illustrating a method for obtaining help command information according to an embodiment of the invention;
FIG. 2 is a block diagram of an apparatus for obtaining help command information according to an embodiment of the present invention;
fig. 3 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various ports, this information should not be limited to these terms. These terms are only used to distinguish one type of device from another. For example, a first port may also be referred to as a second port, and similarly, a second port may also be referred to as a first port, without departing from the scope of the present invention. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The following describes the method for acquiring help command information in an embodiment of the present invention in more detail, but the present invention should not be limited thereto.
In one embodiment, referring to fig. 1, a method for obtaining command help information may include the steps of:
s100: when a first command carrying a help identifier is received, the help identifier is located in a first field of the first command, target command information matched with the first command is found from registered command information, and the target command information at least comprises: a field identification of the first field;
s200: determining a transfer parameter at least containing a field identifier in the target command information;
s300: and calling a help function corresponding to the first command and inputting the transfer parameter to the help function so as to obtain help information corresponding to the transfer parameter by the help function, wherein the help function corresponds to a plurality of commands.
In the embodiment of the present invention, an execution subject of the method for acquiring command help information is an electronic device, and the electronic device may be a computer device, and the specific type is not limited as long as the electronic device has a certain processing capability.
The method for acquiring the command help information in the embodiment of the invention can be applied to a command line of the electronic equipment, wherein the command line is a service program which is operated on the equipment and provides functions of analyzing commands, executing commands and the like, and is not limited in particular.
In step S100, when a first command carrying a help identifier is received, target command information matching the first command is found from the registered command information.
Help identification is for example "? ", of course, the actual may depend on the help identification supported by the command line. A command may contain multiple fields separated by spaces from which the fields may be distinguished.
For example, the command "< DPTECH > show memory frame? The prototype of "is" show memory frame ", wherein" show "occupies a field," memory "occupies a field," frame "occupies a field," ENUMNAME "occupies a field, and" < DPTECH > "indicates view mode, does not occupy a field. Therefore, there are four fields in the command, where help identification "? "in the fourth field" ENUMNAME ".
A plurality of command information may be registered in advance in the command line, and the command information may be held in a tree structure. For example, a field corresponding to a root node of a tree may be a first field of a command, a field corresponding to a child node of the root node (a first level child node) may be a second field following the first field, a field corresponding to a child node of the first level child node (a second level child node) may be a third field following the second field, and so on. Each node maintains information about the corresponding field so that a tree can maintain a plurality of different command information with the same first field.
Therefore, when searching for the target command information matched with the first command from the registered command information, the command line has a plurality of trees storing different command information, a tree structure of a root node corresponding to the first field of the first command can be found first, and then the tree structure is traversed according to the field after the first field of the first command to find out the node where the first field (the last field of the first command) is located, wherein the command information recorded by the node is the target command information matched with the first command.
In the process of traversing the tree structure, the nodes corresponding to the fields in the first command can be stored in the stack according to the storage address, when the search is completed, the node at the top of the stack is the node corresponding to the first field in the first command, and the node at the top of the stack is obtained, so that the target command information can be obtained.
Of course, the registered command information may also be stored in other ways. For example, each command may correspond to an array element in the array, the command information is recorded in the array element, correspondingly, when the target command information is searched, the array element corresponding to the first command is found, and the command information in the found array element is the target command information.
The target command information includes at least: a field identification of the first field. For example, in the prototype "show board-power [ channels estimate ] ]" of one command, the field id of "show" may be "s", "board-power" may be "p", "channels" may be "1", the field id of the first "estimate" may be "a", "slot" may be "2", and the field id of the second "estimate" may be "B", which is given by way of example and not limitation.
The target command information may of course also contain other information, such as: the help type corresponding to the first field, the function call information corresponding to the first command, and the like, which are not limited specifically.
In step S200, a transfer parameter at least including a field identifier in the target command information is determined.
Optionally, the target command information further includes: the help type corresponding to the first field; before determining the transfer parameter at least containing the field identification in the target command information, the method further comprises:
checking whether the help type in the target command information is a dynamic help type, wherein the dynamic help type refers to a help type with variable content on a corresponding field;
if yes, the step of determining the transfer parameter at least containing the field identification in the target command information is continuously executed.
The help types corresponding to the fields include a dynamic help type and an inactive help type, the dynamic help type refers to a help type with variable content in the corresponding field, such as a field for filling parameters corresponds to the dynamic help type, and the inactive help type refers to a help type with invariable content in the corresponding field, such as a field for filling keywords corresponds to the dynamic help type.
Is the first command the command "show memory frame? "as an example, help identification"? "is located in a fourth field, and the fourth field is defined as a field for filling in parameters in the command prototype, that is, the help type corresponding to the fourth field is a dynamic help type, and at this time, steps S200 and S300 need to be performed.
Determine a delivery parameter that contains at least the field identification in the target command information, e.g., "< DPTECH > showmemory frame? "in, if the field identifier corresponding to the fourth field" enum "is" C ", it may be determined that" C "is a delivery parameter.
Optionally, determining a transfer parameter at least including a field identifier in the target command information may include:
when the first command carries parameters, acquiring the parameters in the first command;
and determining the acquired parameters, the number of the parameters and the field identification in the target command information as the transfer parameters.
In other words, when the parameters are carried in the first command, the parameters, the number of the parameters, and the field identifier of the first field of the first command may be used as the transfer parameters; and when the first command does not carry the parameters, the field identifier of the first field can be used as the transfer parameter.
For example, suppose the first command is "show memory frame 0 slot? "where" 0 "is a parameter carried by the first command, the number of parameters is 1, help identification"? If the "is in the sixth field, that is, the first field is the sixth field, the help type corresponding to the first field is the dynamic help type, and the field identifier of the first field is" D ", then" 0 "," 1 "and" D "are determined as the delivery parameters.
In step S300, a help function corresponding to the first command is called and the transfer parameter is input to the help function, so that the help function outputs help information corresponding to the transfer parameter, where the help function corresponds to a plurality of commands.
Optionally, the target command information further includes: function call information corresponding to the first command;
the calling of the help function corresponding to the first command may include:
and calling a help function corresponding to the first command according to the function calling information in the target command information.
The function call information may be, for example, a function name of the help function, and the corresponding help function may be called according to the function name. Of course, the function call information is not limited to the function name of the help function, and may be a function pointer of the help function, as long as the call of the help function can be realized.
When the help function is called, the pass parameter is input into the help function. For example, the prototype of the help function is func _ help (key, helpvec, argc, argv), where helpvec is a result set of help information to be output, key is a field identifier to be input, argc is the number of parameters to be input, argv is a parameter in a command to be input, and the field identifier, the number of parameters, and the parameters in the transfer parameter are respectively assigned to key, argc, and argv.
When the help function is called, help information corresponding to the transfer parameter can be acquired from a database or a configuration file, and the help information is output through the help function. The transmission parameters are composed of field identifications, the number of the parameters and the parameters, and the obtained help information can be different if one of the field identifications, the number of the parameters and the parameters is different.
Therefore, the help function corresponds to a plurality of commands, different transfer parameters can be determined as long as the field identifiers of the fields where the help identifiers are located are different and/or parameters carried by the commands are different, so that the help function can obtain different help information, the same help function can be used by a plurality of commands, and one help function integrates a plurality of help functions.
Alternatively, the help function may correspond to a field preceding the first field. For example, suppose the first command is "show memory frame? ", the help function may correspond to a" frame "; suppose the first command is "show memoryframe 0 slot? ", the help function may correspond to" slot ".
In other words, the target command information includes function call information corresponding to a field immediately preceding the first field, and a help function corresponding to the immediately preceding field can be called according to the function call information. A help function may correspond to a number of different fields, such as both "frame" and "slot".
Alternatively, "show memory frame 0 slot? In the above description, the slot and the frame may also correspond to different help functions, so that a command may use multiple help functions, and the help functions corresponding to the slot and the frame may be called to obtain help information corresponding to the field identifier of the slot and help information corresponding to the field identifier of the frame, respectively, as needed, so that a command may use multiple help functions.
In the embodiment of the invention, one help function can correspond to a plurality of commands, when a first command carrying help identification is received, target command information matched with the first command can be found from registered command information, the target command information at least comprises field identification of a first field where the help identification is located, the help function corresponding to the first command is called, the field identification is used as a transfer parameter and is input into the help function, and the help function can obtain the help information corresponding to the transfer parameter.
Further, in the case that the first command carries parameters, the number of the parameters carried by the first command and the field identifier of the first field may be used as transfer parameters, so that when the help function determines the help information of the transfer function, the parameters carried by the first command play a role in determining, in addition to the field identifier, in other words, in the embodiment of the present invention, the parameters carried by the first command may determine the acquisition of the help information of the field of the following parameters.
In one embodiment, after the help function corresponding to the first command is called and the transfer parameter is input to the help function, the method further includes the following steps:
s400: acquiring help information recorded by a help information data structure corresponding to a first field, wherein the help information data structure corresponding to the first field is created for the first field when the help function is called;
s500: and replacing the help identification in the first command with the acquired help information in the display interface where the first command is located.
When the help function is called, a help information data structure can be created for the first field, and the acquired help information is recorded into the help information data structure corresponding to the first field. The command line may acquire help information recorded in the help information data structure corresponding to the first field, and display the acquired help information in the display interface.
Optionally, after the help function records the obtained help information in the help information data structure corresponding to the first field, the help function may cache the information in the help information data structure. Accordingly, when the help information recorded in the help information data structure corresponding to the first field is obtained, the help information can be obtained from the help information.
When the acquired help information is displayed in the display interface, the help identifier in the first command may be replaced with the acquired help information in the display interface where the first command is located, so that the help information may be displayed on the display interface. Of course, when the help information is displayed, the help identifier may not be replaced, but may be directly added to the display interface, which is not limited specifically.
The following lists several commands and information displayed on the display interface after the commands are executed.
Commanding one: "show memory frame? "this is a command requesting to view help information of an available device frame number in a VSM (Virtual switch matrix, a novel network device virtualization technology for virtualizing a plurality of network devices into one network device) mode, and after the help information is acquired, the following information is displayed on a display interface:
“<DPTECH>show memory frame
0
1”
wherein "frame" represents the frame number of the device in VSM mode, and the help information indicates: there are two devices available, the device block numbers "0" and "1", respectively.
And a second command: "show memory frame 0 slot? "this is a command requesting to view help information of available slot number of the device with frame number 0 in VSM mode, and after obtaining the help information, the following information is displayed on the display interface:
“<DPTECH>show memory frame 0slot
3FW
6MAIN”
wherein "frame 0" represents a device with a frame number of 0, "slot" represents a slot number, and the help information indicates: there are two available slot numbers, one is the work machine (FW) with slot number 3 and the other is the Master control Machine (MAIN) with slot number 6.
And a third command: "show memory frame 0slot 3", which is a command for requesting to view the memory information of the working machine with slot number 3 in the device with frame number 0, and after the memory information is obtained, the following information is displayed on a display interface:
<DPTECH>show memory frame 0slot 3
Frame 0slot 3(FW)
Total Memory:2072316 KB
Reserved Memory:701096 KB
Available Memory:1371220 KB
Total Used Memory:188508 KB
Usage:13%
wherein the displayed memory information indicates that: in the working machine with the slot number of 3 in the device with the frame number of 0, the total memory capacity is 2072316 KB, the reserved memory capacity is 701096 KB, the available memory capacity is 1371220 KB, the used memory capacity is 188508 KB, and the usage rate is 13%.
And a fourth command: "show memory frame 1 slot? "this is a command requesting to view help information of available slot number of the device with frame number 1 in VSM mode, and after obtaining the help information, the following information is displayed on the display interface:
<DPTECH>show memory frame 1slot
7MAIN
wherein the help information indicates: there are 1 available slot numbers, specifically a master control Machine (MAIN) with slot number 7.
And a fifth command: the "show memory frame 1slot 7" is a command for requesting to view the memory information of the main control computer with slot number 7 in the device with frame number 1, and after the memory information is obtained, the following information is displayed on a display interface:
<DPTECH>show memory frame 1slot 7
Frame 1slot 7(MAIN)
Total Memory:8387584 KB
Reserved Memory:561360 KB
Available Memory:7826224 KB
Total Used Memory:1984240 KB
Usage:25%
wherein the displayed memory information indicates that: in the main control computer with slot number 7 in the device with frame number 1, the total memory capacity is 8387584 KB, the reserved memory capacity is 561360 KB, the available memory capacity is 7826224 KB, the used memory capacity is 1984240 KB, and the usage rate is 25%.
In one embodiment, the method further comprises:
when a second command which does not carry a help identification is received, if a second field with a field type being an interface index type exists in the second command, determining an index value corresponding to an interface name on the second field from help information recorded by a help information data structure corresponding to the created second field, and executing the second command according to the index value.
When executing a command requesting help information, the help function stores the help information in the help information data structure created for the corresponding field, and when executing other commands, the help information in the created help information data structure can be directly utilized.
When a second command which does not carry a help identifier is received, if a second field (which may be 1 or more) whose field type is an interface index type exists in the second command, a help information data structure corresponding to the second field may be determined first, where the help information data structure corresponding to the second field is a help information data structure created by a help function for the second field when a third command is executed, the third command is a command in which the content in the second field in the second command is replaced with the help identifier, where help information recorded in the help information data structure corresponding to the second field at least includes an interface name and an index value, and may also include prompt information and the like related to an interface, and an index value corresponding to the interface name in the second field is obtained from the help information, and the second command is executed according to the index value.
When the second command is executed according to the index value, an operation function corresponding to the second command may be obtained, and the index value is input to the operation function, so that the operation function executes a corresponding interface operation according to the index value, for example, related information of an interface is called.
The operation function related to the interface index requires that the input parameter is the interface index, and usually before the operation function is called, a corresponding index value needs to be obtained according to the interface name, but the operation is cumbersome, and the command execution efficiency is low.
In this embodiment, when a command including a second field whose field type is an interface index type is encountered, help information in a help information data structure corresponding to the second field may be used to obtain an index value corresponding to an interface name in the second field from the help information, and a normal method is not required to obtain the index value, so that operation is simple and command execution efficiency is improved.
The present invention also provides a command help information obtaining apparatus, and in one embodiment, referring to fig. 2, the command help information obtaining apparatus 100 may include:
a command matching module 101, configured to, when a first command carrying a help identifier is received, locate the help identifier in a first field of the first command, and find target command information matched with the first command from registered command information, where the target command information at least includes: a field identification of the first field;
a transfer parameter determining module 102, configured to determine a transfer parameter at least including a field identifier in the target command information;
the help information obtaining module 103 is configured to call a help function corresponding to the first command and input the transfer parameter to the help function, so that the help function obtains help information corresponding to the transfer parameter, where the help function corresponds to a plurality of commands.
In an embodiment, when the transfer parameter determining module determines the transfer parameter at least including the field identifier in the target command information, the transfer parameter determining module is specifically configured to:
when the first command carries parameters, acquiring the parameters in the first command;
and determining the acquired parameters, the number of the parameters and the field identification in the target command information as the transfer parameters.
In one embodiment of the present invention,
the target command information further includes: the help type corresponding to the first field;
before the transfer parameter determining module determines the transfer parameter at least containing the field identifier in the target command information, the transfer parameter determining module is further configured to:
checking whether the help type in the target command information is a dynamic help type, wherein the dynamic help type refers to a help type with variable content on a corresponding field;
if yes, the step of determining the transfer parameter at least containing the field identification in the target command information is continuously executed.
In one embodiment of the present invention,
the target command information further includes: function call information corresponding to the first command;
when the help information obtaining module calls the help function corresponding to the first command, the help information obtaining module is specifically configured to:
and calling a help function corresponding to the first command according to the function calling information in the target command information.
In an embodiment, after the help information obtaining module calls a help function corresponding to the first command and inputs the transfer parameter to the help function, the help information obtaining module is further configured to:
acquiring help information recorded by a help information data structure corresponding to a first field, wherein the help information data structure corresponding to the first field is created for the first field when the help function is called;
and replacing the help identification in the first command with the acquired help information in the display interface where the first command is located.
In one embodiment, the apparatus further comprises:
an index value determining module, configured to, when a second command that does not carry a help identifier is received, if a second field whose field type is an interface index type exists in the second command, determine an index value corresponding to an interface name in a created help information corresponding to a help information data structure record of the second field, and execute the second command according to the index value.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts shown as units may or may not be physical units.
The invention also provides an electronic device, which comprises a processor and a memory; the memory stores a program that can be called by the processor; when the processor executes the program, the method for acquiring command help information according to the foregoing embodiment is implemented.
The embodiment of the device for acquiring the command help information can be applied to the electronic equipment. Taking a software implementation as an example, as a logical device, the device is formed by reading, by a processor of the electronic device where the device is located, a corresponding computer program instruction in the nonvolatile memory into the memory for operation. From a hardware aspect, as shown in fig. 3, fig. 3 is a hardware structure diagram of an electronic device where the apparatus 100 for acquiring command help information according to an exemplary embodiment of the present invention is located, and except for the processor 510, the memory 530, the interface 520, and the nonvolatile memory 540 shown in fig. 3, the electronic device where the apparatus 100 is located in the embodiment may also include other hardware according to an actual function of the electronic device, which is not described again.
The present invention also provides a machine-readable storage medium on which a program is stored, which, when executed by a processor, implements the method for acquiring command help information as described in the foregoing embodiments.
The present invention may take the form of a computer program product embodied on one or more storage media including, but not limited to, disk storage, CD-ROM, optical storage, and the like, having program code embodied therein. Machine-readable storage media include both permanent and non-permanent, removable and non-removable media, and the storage of information may be accomplished by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of machine-readable storage media include, but are not limited to: phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technologies, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic tape storage or other magnetic storage devices, or any other non-transmission medium, may be used to store information that may be accessed by a computing device.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for obtaining command help information, comprising:
when a first command carrying a help identifier is received, the help identifier is located in a first field of the first command, target command information matched with the first command is found from registered command information, and the target command information at least comprises: a field identification of the first field;
determining a transfer parameter at least containing a field identifier in the target command information;
and calling a help function corresponding to the first command and inputting the transfer parameter to the help function so as to obtain help information corresponding to the transfer parameter by the help function, wherein the help function corresponds to a plurality of commands.
2. The method for obtaining command assistance information according to claim 1, wherein determining the delivery parameter at least including the field id in the target command information includes:
when the first command carries parameters, acquiring the parameters in the first command;
and determining the acquired parameters, the number of the parameters and the field identification in the target command information as the transfer parameters.
3. The command help information acquisition method according to claim 1,
the target command information further includes: the help type corresponding to the first field;
before determining the transfer parameter at least containing the field identifier in the target command information, the method further comprises:
checking whether the help type in the target command information is a dynamic help type, wherein the dynamic help type refers to a help type with variable content on a corresponding field;
if yes, the step of determining the transfer parameter at least containing the field identification in the target command information is continuously executed.
4. The command help information acquisition method according to claim 1,
the target command information further includes: function call information corresponding to the first command;
calling a help function corresponding to the first command, wherein the calling comprises:
and calling a help function corresponding to the first command according to the function calling information in the target command information.
5. The method for acquiring command help information of claim 1, wherein after calling the help function corresponding to the first command and inputting the transfer parameter to the help function, the method further comprises:
acquiring help information recorded by a help information data structure corresponding to a first field, wherein the help information data structure corresponding to the first field is created for the first field when the help function is called;
and replacing the help identification in the first command with the acquired help information in the display interface where the first command is located.
6. The method of claim 5, further comprising:
when a second command which does not carry a help identification is received, if a second field with a field type being an interface index type exists in the second command, determining an index value corresponding to an interface name on the second field from help information recorded by a help information data structure corresponding to the created second field, and executing the second command according to the index value.
7. An apparatus for acquiring command help information, comprising:
a command matching module, configured to, when a first command carrying a help identifier is received, locate the help identifier in a first field of the first command, and find target command information that matches the first command from registered command information, where the target command information at least includes: a field identification of the first field;
a transfer parameter determining module, configured to determine a transfer parameter at least including a field identifier in the target command information;
and the help information acquisition module is used for calling a help function corresponding to the first command and inputting the transfer parameter to the help function so as to acquire help information corresponding to the transfer parameter by the help function, wherein the help function corresponds to a plurality of commands.
8. The command help information acquisition apparatus according to claim 7,
the target command information further includes: the help type corresponding to the first field;
before the transfer parameter determining module determines the transfer parameter at least containing the field identifier in the target command information, the transfer parameter determining module is further configured to:
checking whether the help type in the target command information is a dynamic help type, wherein the dynamic help type refers to a help type with variable content on a corresponding field;
if yes, the step of determining the transfer parameter at least containing the field identification in the target command information is continuously executed.
9. The apparatus for obtaining command help information according to claim 7, wherein after the help information obtaining module calls a help function corresponding to the first command and inputs the transfer parameter to the help function, the apparatus is further configured to:
acquiring help information recorded by a help information data structure corresponding to a first field, wherein the help information data structure corresponding to the first field is created for the first field when the help function is called;
and replacing the help identification in the first command with the acquired help information in the display interface where the first command is located.
10. The apparatus for acquiring command help information of claim 9, further comprising:
an index value determining module, configured to, when a second command that does not carry a help identifier is received, if a second field whose field type is an interface index type exists in the second command, determine an index value corresponding to an interface name in a created help information corresponding to a help information data structure record of the second field, and execute the second command according to the index value.
CN201911359852.9A 2019-12-25 2019-12-25 Method and device for acquiring command help information Active CN111143006B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911359852.9A CN111143006B (en) 2019-12-25 2019-12-25 Method and device for acquiring command help information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911359852.9A CN111143006B (en) 2019-12-25 2019-12-25 Method and device for acquiring command help information

Publications (2)

Publication Number Publication Date
CN111143006A true CN111143006A (en) 2020-05-12
CN111143006B CN111143006B (en) 2022-11-01

Family

ID=70520153

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911359852.9A Active CN111143006B (en) 2019-12-25 2019-12-25 Method and device for acquiring command help information

Country Status (1)

Country Link
CN (1) CN111143006B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113467868A (en) * 2016-08-26 2021-10-01 华为数字技术(成都)有限公司 Method and device for creating equipment resources

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1534460A (en) * 2003-03-28 2004-10-06 烽火通信科技股份有限公司 Management method possessing real time helping function in insertion type system
CN1567264A (en) * 2003-06-20 2005-01-19 华为技术有限公司 Method of on-line assistance for user based on man machine lagnuage
CN1719786A (en) * 2004-07-08 2006-01-11 中兴通讯股份有限公司 Automatic testing system and method for command of command line interface of data communication apparatus
CN1780235A (en) * 2004-11-19 2006-05-31 中兴通讯股份有限公司 Automatic spell checking method and system for interface command line in telecommunication apparatus
CN102043570A (en) * 2009-10-22 2011-05-04 华为技术有限公司 Command line input method and device
CN107741979A (en) * 2017-10-17 2018-02-27 山东浪潮通软信息科技有限公司 A kind of help information display methods and device
US20180275926A1 (en) * 2017-03-21 2018-09-27 Ricoh Company, Ltd. Information processing system, help display method, and electronic device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1534460A (en) * 2003-03-28 2004-10-06 烽火通信科技股份有限公司 Management method possessing real time helping function in insertion type system
CN1567264A (en) * 2003-06-20 2005-01-19 华为技术有限公司 Method of on-line assistance for user based on man machine lagnuage
CN1719786A (en) * 2004-07-08 2006-01-11 中兴通讯股份有限公司 Automatic testing system and method for command of command line interface of data communication apparatus
CN1780235A (en) * 2004-11-19 2006-05-31 中兴通讯股份有限公司 Automatic spell checking method and system for interface command line in telecommunication apparatus
CN102043570A (en) * 2009-10-22 2011-05-04 华为技术有限公司 Command line input method and device
US20180275926A1 (en) * 2017-03-21 2018-09-27 Ricoh Company, Ltd. Information processing system, help display method, and electronic device
CN107741979A (en) * 2017-10-17 2018-02-27 山东浪潮通软信息科技有限公司 A kind of help information display methods and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113467868A (en) * 2016-08-26 2021-10-01 华为数字技术(成都)有限公司 Method and device for creating equipment resources
CN113467868B (en) * 2016-08-26 2023-12-15 成都华为技术有限公司 Method and device for creating equipment resources

Also Published As

Publication number Publication date
CN111143006B (en) 2022-11-01

Similar Documents

Publication Publication Date Title
CN108205577B (en) Array construction method, array query method, device and electronic equipment
CN103345469B (en) The storage of set of numbers, querying method and device thereof
CN104756107A (en) Profiling data with location information
JP2002229825A (en) Computer memory
CN111475105B (en) Monitoring data storage method, monitoring data storage device, monitoring data server and storage medium
CN103218365A (en) SS Table file data processing method and system
US20200042538A1 (en) Methods and apparatus to partition a database
CN108205571B (en) Key value data table connection method and device
KR20190079354A (en) Partitioned space based spatial data object query processing apparatus and method, storage media storing the same
CN111708895B (en) Knowledge graph system construction method and device
US6044369A (en) Hash table call router for widely varying function interfaces
CN111143006B (en) Method and device for acquiring command help information
CN114840487A (en) Metadata management method and device for distributed file system
CN109033456B (en) Condition query method and device, electronic equipment and storage medium
CN113190576A (en) Data processing method and device, computer equipment and readable storage medium
CN116049180A (en) Tenant data processing method and device for Paas platform
CN106991116A (en) The optimization method and device of database executive plan
CN110399396B (en) Efficient data processing
CN111666302A (en) User ranking query method, device, equipment and storage medium
CN110221778A (en) Processing method, system, storage medium and the electronic equipment of hotel&#39;s data
CN110928941A (en) Data fragment extraction method and device
US11580251B1 (en) Query-based database redaction
CN116450607A (en) Data processing method, device and storage medium
CN116010345A (en) Method, device and equipment for realizing table service scheme of flow batch integrated data lake
CN115225308A (en) Attack group identification method and related equipment for large-scale group attack traffic

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant