Command line execution method, system, storage medium and electronic device

By converting command statements into dynamic library function functions and loading them into the command tree, the high coupling and scalability problems of command line managers in the existing technology are solved, cross-platform and efficient command line management are realized, and porting is simplified. and debugging process.

CN114296741BActive Publication Date: 2024-12-20无锡沐创集成电路设计有限公司
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202111638515.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2024-12-20
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

The existing command line managers have problems such as high coupling, difficulty in sharing on other devices, multi-reliance on three-party software, large amount of transplant projects, cumbersome function implementation, difficult debugging, single architecture and inconvenient expansion.

Method used

Provides a command line execution method and system, which converts the command statements entered by the user into the dynamic library function format and loads them into the manager's command tree, and uses the command tree structure to execute functions, supporting cross-platform and good scalability. .

Benefits of technology

It realizes cross-platform, scalable, convenient, simple and efficient command line management tools, reduces the coupling between devices, simplifies the porting process, and improves the flexibility of functions and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114296741B_ABST
    Figure CN114296741B_ABST
Patent Text Reader

Abstract

The present application relates to the field of data processing technology, and specifically to a command line execution method, system, storage medium and electronic device, including: receiving a command statement input by a user; converting the command statement into a command line function in a dynamic library function format; loading the command line function into a manager command tree; and executing the manager command tree. The present application parses and loads command lines in a dynamic library function format, and can be called by languages ​​such as Java and Php, making it easy to use in different usage environments, and having good scalability and cross-platform application conditions. The command line manager uses a command tree structure to execute command line functions, and can easily add or delete command line functions, further improving scalability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a command line execution method, system, storage medium and electronic device. Background Art

[0002] In recent years, with the continuous development of various embedded platforms and the continuous growth of various Linux open source communities, various embedded devices based on Linux systems have emerged in an endless stream, and the means of development, debugging, and use are also varied.

[0003] The existing command line managers for various devices have the following problems: they are highly coupled with their own devices and cannot be shared with other devices. They rely on many third-party software and require a huge amount of migration work. They are cumbersome to implement functions and difficult to debug and test the command line itself. They have a single implementation architecture and are not easy to expand. Summary of the invention

[0004] In response to the above problems, the present application provides a command line execution method, system, storage medium and electronic device, providing a cross-platform, scalable, convenient, simple and efficient management tool.

[0005] In a first aspect, the present application provides a command line execution method, the method comprising:

[0006] Receive command statements input by users;

[0007] Convert the command statement into a command line function in a dynamic library function format;

[0008] loading the command line function into a manager command tree;

[0009] Execute the manager command tree.

[0010] In some embodiments, the command statement is converted into a command line function in a dynamic library function format, including:

[0011] Storing the command statement in a command line configuration file;

[0012] The command line configuration file is parsed by a configuration file parsing script to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement.

[0013] In some embodiments, the command line configuration file is parsed by a configuration file parsing script to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement, including:

[0014] Parsing the command line configuration file through a configuration file parsing script to obtain a command line function corresponding to the command statement;

[0015] Searching a preset function mapping table according to the command line function of the command statement to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement;

[0016] The function mapping table includes a mapping relationship between a command line function of a command statement and a command line function in a dynamic library function format.

[0017] In some embodiments, loading the command line function into the manager command tree includes:

[0018] confirming the level and position of the command line function in the manager command tree;

[0019] The command line function is loaded into the manager command tree according to the level and position of the command line function in the manager command tree.

[0020] In a second aspect, a command line execution system is provided, the system comprising:

[0021] The command line configuration module is used to receive the command statement input by the user; convert the command statement into a command line function in the format of a dynamic library function;

[0022] A command line loading module, used to load the command line function into the manager command tree;

[0023] A command line execution module is used to execute the manager command tree.

[0024] In some embodiments, the command line configuration module includes:

[0025] A storage unit, used for storing the command statement in a command line configuration file;

[0026] The parsing unit is used to parse the command line configuration file through a configuration file parsing script to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement.

[0027] In some embodiments, the parsing unit comprises:

[0028] A parsing subunit, used to parse the command line configuration file through a configuration file parsing script to obtain a command line function corresponding to the command statement;

[0029] A search subunit, used to search a preset function mapping table according to the command line function of the command statement, and obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement;

[0030] The function mapping table includes a mapping relationship between a command line function of a command statement and a command line function in a dynamic library function format.

[0031] In some embodiments, the command line loading module includes:

[0032] A confirmation unit, used to confirm the level and position of the command line function in the manager command tree;

[0033] The loading unit is used to load the command line function into the manager command tree according to the level and position of the command line function in the manager command tree.

[0034] In a third aspect, a storage medium stores a computer program that can be executed by one or more processors and can be used to implement the command line execution method described in the first aspect.

[0035] In a fourth aspect, an electronic device includes a memory and a processor, wherein a computer program is stored in the memory, and the memory and the processor are communicatively connected to each other, and when the computer program is executed by the processor, the command line execution method described in the first aspect is executed.

[0036] The present application provides a command line execution method, system, storage medium and electronic device, including: receiving a command statement input by a user; converting the command statement into a command line function in a dynamic library function format; loading the command line function into a manager command tree; and executing the manager command tree. The present application parses and loads command lines in a dynamic library function format, and can be called by languages ​​such as Java and Php, making it easy to use in different usage environments, and having good scalability and cross-platform application conditions. The command line manager uses a command tree structure to execute command line functions, and can easily add or delete command line functions, further improving scalability. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0038] Figure 1A flowchart of a command line execution method provided in an embodiment of the present application;

[0039] Figure 2 A schematic diagram of the command tree structure provided for an embodiment of the present application;

[0040] Figure 3 A schematic diagram of the structure of a command line execution system provided in an embodiment of the present application;

[0041] Figure 4 A connection block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The following will describe the implementation methods of the present application in detail with reference to the accompanying drawings and embodiments, so that the implementation process of how the present application applies technical means to solve technical problems and achieve corresponding technical effects can be fully understood and implemented accordingly. The embodiments of the present application and the various features in the embodiments can be combined with each other without conflict, and the technical solutions formed are all within the scope of protection of the present application.

[0043] As can be seen from the background technology, the existing command line managers for various devices have the following problems: they are highly coupled with their own devices and cannot be shared with other devices. They rely on many third-party software and require a huge amount of transplantation work. The function implementation is cumbersome, and the command line itself is difficult to debug and test. The implementation architecture is single and not easy to expand.

[0044] In view of this, the present application provides a command line execution method, system, storage medium and electronic device, providing a cross-platform, scalable, convenient, simple and efficient management tool.

[0045] Embodiment 1

[0046] Figure 1 A flowchart of a command line execution method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0047] S101, receiving a command statement input by a user;

[0048] S102, converting the command statement into a command line function in a dynamic library function format;

[0049] S103, loading the command line function into the manager command tree;

[0050] S104: Execute the manager command tree.

[0051] It should be noted that the command line execution method of the present application is applied to the command line manager. The command line manager of the present application uses command parsing, script mounting, and program execution to load commands, and can be used on any platform. The manager function is completely independently developed, does not rely on third-party tools, and has good cross-platform porting and application conditions. The manager adopts a command tree architecture with a "layered" feature, in which each layer can be independently developed and debugged if problems are encountered, and does not affect the operation and use of the remaining layers. It has good scalability and flexible change capabilities. The manager runs in the form of program + dynamic library. The program is responsible for executing the command line, and the dynamic library is responsible for command parsing, command line loading, etc. Therefore, the command parsing and loading of the command line core can be called by languages ​​such as Java and Php in the form of dynamic libraries, which is convenient for application in different usage environments and has good scalability.

[0052] The CLI command tree structure of the command line manager includes: using the characteristics of the tree structure (single-order structure of parent and child nodes) to build the architecture of the manager command line, which is loaded by the manager command line program in the form of a dynamic library. After loading, the "CLI command tree structure" can be applied to the manager. The command tree structure is the "skeleton" of the manager command line. Its use of its own tree structure characteristics ensures the "precise matching" and "hierarchical relationship" of each command in the command line.

[0053] Specifically, in another embodiment, Figure 2 The figure shows a schematic diagram of the command tree structure.

[0054] In some embodiments, the command statement is converted into a command line function in a dynamic library function format, including:

[0055] Storing the command statement in a command line configuration file;

[0056] The command line configuration file is parsed by a configuration file parsing script to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement.

[0057] It should be noted that the manager provides users with an editable command line configuration file. Users can add commands to the configuration file instead of adding commands to the program, which improves user experience and usage efficiency.

[0058] In some embodiments, the command line configuration file is parsed by a configuration file parsing script to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement, including:

[0059] Parsing the command line configuration file through a configuration file parsing script to obtain a command line function corresponding to the command statement;

[0060] Searching a preset function mapping table according to the command line function of the command statement to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement;

[0061] The function mapping table includes a mapping relationship between a command line function of a command statement and a command line function in a dynamic library function format.

[0062] It should be noted that after the user adds the command, the configuration file parsing script in the command line configuration module parses and converts the command-related functions such as command words and input data in the command line configuration file, and maps the command line functions into dynamic library functions that can be loaded by the manager. The manager loads these function functions in the form of a dynamic library, that is, the corresponding command line functions are available in the manager program.

[0063] Specifically, the command statement content stored in the command line configuration file includes: command line content, command line prompt, command line level, command line authority, command line response program, and command line ID;

[0064] Command line content: is the content entered by the user using the command line;

[0065] Command line prompt: If the user does not know what to enter, he can press the TAB key to pop up the corresponding input prompt;

[0066] Command line level: The level of each command. High-level commands can only be executed after low-level commands are executed.

[0067] Command line permissions: divided into view and configure permissions. View permissions allow you to view command configurations, and configure permissions allow you to configure commands.

[0068] Command line responder: specify the processing function corresponding to the command;

[0069] Command line ID: command distinction when multiple commands specify the same processing function.

[0070] In some embodiments, loading the command line function into the manager command tree includes:

[0071] confirming the level and position of the command line function in the manager command tree;

[0072] The command line function is loaded into the manager command tree according to the level and position of the command line function in the manager command tree.

[0073] It should be noted that since the execution of command line functions may require pre-functions, they may be at the second or third level. Therefore, it is necessary to first confirm the level and position of the command line function in the manager command tree, and then load it to the corresponding level and position before executing it in the manager.

[0074] In some embodiments, the method further comprises:

[0075] Display command execution results and related information to the user.

[0076] In summary, the embodiment of the present application provides a command line execution method, including: receiving a command statement input by a user; converting the command statement into a command line function in a dynamic library function format; loading the command line function into a manager command tree; and executing the manager command tree. The present application parses and loads command lines in a dynamic library function format, and can be called by languages ​​such as Java and Php, making it easy to use in different usage environments, and having good scalability and cross-platform application conditions. The command line manager uses a command tree structure to execute command line functions, and can easily add or delete command line functions, further improving scalability.

[0077] Embodiment 2

[0078] Based on the command line execution method disclosed in the above embodiment of the present invention, Figure 3 Specifically disclosed is a command line execution system applying the command line execution method.

[0079] like Figure 3 As shown, an embodiment of the present invention discloses a command line execution system, the system comprising:

[0080] The command line configuration module 301 is used to receive a command statement input by a user; convert the command statement into a command line function in a dynamic library function format;

[0081] A command line loading module 302, used to load the command line function into the manager command tree;

[0082] The command line execution module 303 is used to execute the manager command tree.

[0083] It should be noted that the command line execution method of the present application is applied to the command line manager. The command line manager of the present application uses command parsing, script mounting, and program execution to load commands, and can be used on any platform. The manager function is completely independently developed, does not rely on third-party tools, and has good cross-platform porting and application conditions. The manager adopts a command tree architecture with a "layered" feature, in which each layer can be independently developed and debugged if problems are encountered, and does not affect the operation and use of the remaining layers. It has good scalability and flexible change capabilities. The manager runs in the form of program + dynamic library. The program is responsible for executing the command line, and the dynamic library is responsible for command parsing, command line loading, etc. Therefore, the command parsing and loading of the command line core can be called by languages ​​such as Java and Php in the form of dynamic libraries, which is convenient for application in different usage environments and has good scalability.

[0084] The CLI command tree structure of the command line manager includes: using the characteristics of the tree structure (single-order structure of parent and child nodes) to build the architecture of the manager command line, which is loaded by the manager command line program in the form of a dynamic library. After loading, the "CLI command tree structure" can be applied to the manager. The command tree structure is the "skeleton" of the manager command line. Its use of its own tree structure characteristics ensures the "precise matching" and "hierarchical relationship" of each command in the command line.

[0085] Specifically, in another embodiment, Figure 2 The figure shows a schematic diagram of the command tree structure.

[0086] In some embodiments, the command line configuration module includes:

[0087] A storage unit, used for storing the command statement in a command line configuration file;

[0088] The parsing unit is used to parse the command line configuration file through a configuration file parsing script to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement.

[0089] It should be noted that the manager provides users with an editable command line configuration file. Users can add commands to the configuration file instead of adding commands to the program, which improves user experience and usage efficiency.

[0090] In some embodiments, the parsing unit comprises:

[0091] A parsing subunit, used to parse the command line configuration file through a configuration file parsing script to obtain a command line function corresponding to the command statement;

[0092] A search subunit, used to search a preset function mapping table according to the command line function of the command statement, and obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement;

[0093] The function mapping table includes a mapping relationship between a command line function of a command statement and a command line function in a dynamic library function format.

[0094] It should be noted that after the user adds the command, the configuration file parsing script in the command line configuration module parses and converts the command-related functions such as command words and input data in the command line configuration file, and maps the command line functions into dynamic library functions that can be loaded by the manager. The manager loads these function functions in the form of a dynamic library, that is, the corresponding command line functions are available in the manager program.

[0095] Specifically, the command statement content stored in the command line configuration file includes: command line content, command line prompt, command line level, command line authority, command line response program, and command line ID;

[0096] Command line content: is the content entered by the user using the command line;

[0097] Command line prompt: If the user does not know what to enter, he can press the TAB key to pop up the corresponding input prompt;

[0098] Command line level: The level of each command. High-level commands can only be executed after low-level commands are executed.

[0099] Command line permissions: divided into view and configure permissions. View permissions allow you to view command configurations, and configure permissions allow you to configure commands.

[0100] Command line responder: specify the processing function corresponding to the command;

[0101] Command line ID: command distinction when multiple commands specify the same processing function.

[0102] In some embodiments, the command line loading module includes:

[0103] A confirmation unit, used to confirm the level and position of the command line function in the manager command tree;

[0104] The loading unit is used to load the command line function into the manager command tree according to the level and position of the command line function in the manager command tree.

[0105] It should be noted that since the execution of command line functions may require pre-functions, they may be at the second or third level. Therefore, it is necessary to first confirm the level and position of the command line function in the manager command tree, and then load it to the corresponding level and position before executing it in the manager.

[0106] In some embodiments, the system further comprises:

[0107] The display unit is used to display command execution results and related information to the user.

[0108] In summary, the embodiment of the present application provides a command line execution system, including: receiving a command statement input by a user; converting the command statement into a command line function in a dynamic library function format; loading the command line function into a manager command tree; and executing the manager command tree. The present application parses and loads command lines in a dynamic library function format, and can be called by languages ​​such as Java and Php, making it easy to use in different usage environments, and having good scalability and cross-platform application conditions. The command line manager uses a command tree structure to execute command line functions, and can easily add or delete command line functions, further improving scalability.

[0109] Embodiment 3

[0110] This embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored. When the computer program is executed by a processor, the method steps of the first embodiment can be implemented, and this embodiment will not be repeated here.

[0111] Embodiment 4

[0112] Figure 4 A connection block diagram of an electronic device 500 provided in an embodiment of the present application, such as Figure 4 As shown, the electronic device 500 may include: a processor 501 , a memory 502 , a multimedia component 503 , an input / output (I / O) interface 504 , and a communication component 505 .

[0113] The processor 501 is used to execute all or part of the steps in the command line execution method in Embodiment 1. The memory 502 is used to store various types of data, which may include instructions of any application or method in the electronic device, and data related to the application.

[0114] The processor 501 can be an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a controller, a microcontroller, a microprocessor or other electronic components, and is used to execute the command line execution method in the above-mentioned embodiment 1.

[0115] The memory 502 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0116] The multimedia component 503 may include a screen and an audio component, the screen may be a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, and the microphone is used to receive external audio signals. The received audio signal may be further stored in a memory or sent via a communication component. The audio component also includes at least one speaker for outputting audio signals.

[0117] The I / O interface 504 provides an interface between the processor 501 and other interface modules, which may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons.

[0118] The communication component 505 is used for wired or wireless communication between the electronic device 500 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 505 can include: Wi-Fi module, Bluetooth module, NFC module.

[0119] In summary, the present application provides a command line execution method, system, storage medium and electronic device, the method comprising: receiving a command statement input by a user; converting the command statement into a command line function in a dynamic library function format; loading the command line function into a manager command tree; and executing the manager command tree. The present application parses and loads command lines in a dynamic library function format, and can be called by languages ​​such as Java and Php, making it easy to use in different usage environments, and having good scalability and cross-platform application conditions. The command line manager uses a command tree structure to execute command line functions, and can easily add or delete command line functions, further improving scalability.

[0120] In the several embodiments provided in the present application, it should be understood that the disclosed method can also be implemented in other ways. The method embodiments described above are merely illustrative.

[0121] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0122] Although the implementation methods disclosed in this application are as above, the above contents are only the implementation methods adopted for facilitating the understanding of this application, and are not intended to limit this application. Any technician in the technical field to which this application belongs can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed in this application, but the scope of patent protection of this application shall still be based on the scope defined in the attached claims.

Claims

1. A command line execution method, characterized in that: The method comprises: Receive command statements input by users; Convert the command statement into a command line function in a dynamic library function format; loading the command line function into a manager command tree; executing the manager command tree; The command line function of converting the command statement into a dynamic library function format includes: Storing the command statement in a command line configuration file; Parsing the command line configuration file through a configuration file parsing script to obtain a command line function corresponding to the command statement; Searching a preset function mapping table according to the command line function of the command statement to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement; The function mapping table includes a mapping relationship between a command line function of a command statement and a command line function in a dynamic library function format.

2. The method according to claim 1, characterized in that The step of loading the command line function into the manager command tree comprises: confirming the level and position of the command line function in the manager command tree; The command line function is loaded into the manager command tree according to the level and position of the command line function in the manager command tree.

3. A command line execution system, characterized in that: The system comprises: The command line configuration module is used to receive the command statement input by the user; convert the command statement into a command line function in the format of a dynamic library function; A command line loading module, used to load the command line function into the manager command tree; A command line execution module, used for executing the manager command tree; The command line configuration module includes: A storage unit, used for storing the command statement in a command line configuration file; The parsing unit comprises a parsing subunit and a searching subunit: the parsing subunit is used to parse the command line configuration file through a configuration file parsing script to obtain a command line function corresponding to the command statement; the searching subunit is used to search a preset function mapping table according to the command line function of the command statement to obtain a command line function in a dynamic library function format corresponding to the command line function of the command statement; The function mapping table includes a mapping relationship between a command line function of a command statement and a command line function in a dynamic library function format.

4. The system according to claim 3, characterized in that The command line loading module includes: A confirmation unit, used to confirm the level and position of the command line function in the manager command tree; The loading unit is used to load the command line function into the manager command tree according to the level and position of the command line function in the manager command tree.

5. A storage medium, characterized in that: The computer program stored in the storage medium can be executed by one or more processors and can be used to implement the command line execution method as claimed in any one of claims 1 to 2.

6. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and the memory and the processor are connected to communicate with each other. When the computer program is executed by the processor, the command line execution method according to any one of claims 1 to 2 is executed.

Citation Information

Patent Citations

  • Method for implementing command-line interface

    CN101916187A

  • Method and device for realizing network equipment CLI (Command Line Interface for batch scripti) based on dynamic configuration

    CN101924656A

  • Instruction processing method, terminal and storage medium

    CN112052047A

  • Electronic scale data updating method, device and equipment and readable storage medium

    CN112114978A

  • Data docking system and method and computer readable storage medium

    CN113835786A