CN118051218A - Visual execution method and device for terminal command, electronic equipment and storage medium - Google Patents

Visual execution method and device for terminal command, electronic equipment and storage medium Download PDF

Info

Publication number
CN118051218A
CN118051218A CN202410229882.2A CN202410229882A CN118051218A CN 118051218 A CN118051218 A CN 118051218A CN 202410229882 A CN202410229882 A CN 202410229882A CN 118051218 A CN118051218 A CN 118051218A
Authority
CN
China
Prior art keywords
command
button
option
user
configuration file
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.)
Pending
Application number
CN202410229882.2A
Other languages
Chinese (zh)
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.)
Ecarx Hubei Tech Co Ltd
Original Assignee
Ecarx Hubei Tech 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 Ecarx Hubei Tech Co Ltd filed Critical Ecarx Hubei Tech Co Ltd
Priority to CN202410229882.2A priority Critical patent/CN118051218A/en
Publication of CN118051218A publication Critical patent/CN118051218A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30076Arrangements for executing specific machine instructions to perform miscellaneous control operations, e.g. NOP
    • 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Input From Keyboards Or The Like (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a terminal command visual execution method, a device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a configuration file, wherein the configuration file comprises a command name, a button and a command option of a command to be configured; adding an event processing function to the button based on the configuration file, and rendering the button according to the command option; responding to the clicking event of the button, analyzing command options corresponding to the button through the event processing function, and determining command line grammar corresponding to the command to be configured; executing the command line grammar; and calling up a terminal panel, and outputting an execution result of the command to be configured at the terminal panel. The embodiment of the invention provides a more convenient and efficient terminal command execution mode for the user, and can improve the working efficiency and reduce the error rate.

Description

Visual execution method and device for terminal command, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method for performing terminal command visualization, a device for performing terminal command visualization, an electronic device, and a storage medium.
Background
A Terminal Command (Terminal Command) is an instruction entered in a computer Terminal or Command line interface for interacting with an operating system, performing a specific operation, or running a program. The terminal command may be a command carried by the operating system or provided by additional software or tools installed.
The terminal command is typically composed of a command name and parameters. The command name indicates the operation to be performed or the program to be run, and the parameters provide further description or configuration. By inputting correct commands and parameters in the terminal, the user can directly interact with the operating system to complete the required tasks.
For complex tasks or operations requiring multiple command combinations to be performed, users often need to remember a series of commands and parameters, which can lead to input errors or waste time, adding a heavy instruction memory burden to the user.
Disclosure of Invention
Aiming at the defects in the prior art, the embodiment of the invention provides a terminal command visual execution method, a terminal command visual execution device, electronic equipment and a storage medium.
In a first aspect, an embodiment of the present invention provides a method for visually executing a terminal command, including:
acquiring a configuration file, wherein the configuration file comprises a command name, a button and a command option of a command to be configured;
Adding an event processing function to the button based on the configuration file, and rendering the button according to the command option;
Responding to the clicking event of the button, analyzing command options corresponding to the button through the event processing function, and determining command line grammar corresponding to the command to be configured;
executing the command line grammar;
And calling up a terminal panel, and outputting an execution result of the command to be configured at the terminal panel.
The method, optionally, the obtaining the configuration file includes:
receiving a command name, a button and a command option of a command to be configured, which are input by a user;
Generating and storing a configuration file based on the command name, the button and the command option;
and acquiring the configuration file from a storage area.
As above, optionally, the receiving the command name, button, command option and command parameter of the command to be configured, which are input by the user, includes:
Determining a button of a command to be configured in response to a button selected by a user;
Determining a command name of a command to be configured in response to a command name input by a user;
in response to a command option entered or selected by a user, a command option for a command to be configured is determined.
As described above, optionally, in response to a command option entered by a user, determining a command option for a command to be configured includes:
responding to a user input command option, and determining a command name and a command option of a secondary command corresponding to the command to be configured;
responding to the command option of the secondary command, and continuing to determine the command name and the command option of the tertiary command corresponding to the secondary command until the termination condition is met;
And associating the command names and command options of all commands as command options of the commands to be configured.
As above, optionally, in response to a command option selected by a user, determining a command option of a command to be configured includes:
acquiring all commands associated with the command options;
and associating the command options selected by the user with all the associated commands, and determining the command options corresponding to the commands to be configured.
The method above, optionally, before generating the configuration file based on the command name, the button and the command option, further includes:
And verifying the command options according to a preset security verification method, and passing the verification.
As mentioned above, optionally, the preset security verification method includes:
regular expression, white list verification, or parameter type checking.
The method above, optionally, the configuration file further includes: command parameters of the command to be configured;
the responding to the clicking event of the button, analyzing the command options corresponding to the button through the event processing function, and determining the command line grammar corresponding to the command to be configured comprises the following steps:
And responding to the clicking event of the button, analyzing the command options and command parameters corresponding to the button through the event processing function, and assembling the command line grammar corresponding to the command to be configured.
In a second aspect, an embodiment of the present invention provides a terminal command visualization execution device, including:
the system comprises an acquisition module, a configuration module and a control module, wherein the acquisition module is used for acquiring a configuration file, and the configuration file comprises a command name, a button and a command option of a command to be configured;
The event adding module is used for adding event processing functions for the buttons based on the configuration files and rendering the buttons according to the command options;
The assembling module is used for responding to the clicking event of the button, analyzing the command options corresponding to the button through the event processing function and determining the command line grammar corresponding to the command to be configured;
An execution module for executing the command line grammar;
and the output module is used for calling up a terminal panel and outputting an execution result of the command to be configured on the terminal panel.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
The device comprises a memory and a processor, wherein the processor and the memory are communicated with each other through a bus; the memory stores program instructions executable by the processor, the processor invoking the program instructions to enable execution of the terminal command visualization execution method according to any of the first aspects above.
In a fourth aspect, an embodiment of the present invention provides a storage medium having stored thereon a computer program which, when executed by a processor, implements a terminal command visualization execution method according to any of the first aspects above.
The visual execution method of the terminal command provided by the embodiment of the invention obtains the configuration file, wherein the configuration file comprises a command name, a button and a command option of a command to be configured; adding an event processing function to the button based on the configuration file, and rendering the button according to the command option; responding to the clicking event of the button, analyzing command options corresponding to the button through the event processing function, and determining command line grammar corresponding to the command to be configured; executing the command line grammar; and calling up a terminal panel, and outputting an execution result of the command to be configured at the terminal panel. According to the terminal command visual execution method provided by the embodiment of the invention, the terminal command is converted into the visual graphic buttons, each command is provided with the graphic buttons corresponding to the command, and a user can intuitively identify and operate the graphic elements, so that a more convenient and efficient terminal command execution mode is provided for the user, the working efficiency is improved, and the error rate is reduced.
Drawings
FIG. 1 is a flow chart of steps of an embodiment of a method for visually executing a terminal command according to the present invention;
FIG. 2 is a schematic diagram of a button rendering result in an embodiment of a method for visually executing a terminal command according to the present invention;
FIG. 3 is a schematic diagram of a button execution result in an embodiment of a method for visually executing a terminal command according to the present invention;
FIG. 4 is a schematic diagram of a button configuration interface in an embodiment of a method for visually executing a terminal command according to the present invention;
FIG. 5 is a flow chart of steps of another embodiment of a method for visually executing a terminal command according to the present invention;
FIG. 6 is a block diagram of an embodiment of a visual execution device for terminal commands according to the present invention;
fig. 7 is a block diagram of an embodiment of an electronic device of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
Referring to fig. 1, a step flow chart of an embodiment of a method for performing visualized terminal command execution of the present invention is shown, which may specifically include the following steps:
step S110, acquiring a configuration file, wherein the configuration file comprises a command name, a button and a command option of a command to be configured;
Specifically, firstly, a configuration file of a command to be configured is obtained, wherein the configuration file can comprise a command name, a button and a command option of the command to be configured, the command name can be a name set by a user for a terminal command, can be a name of a terminal command or a name of a group of terminal commands, and can be manually input by the user or can be a name provided by a system for user selection. The buttons include button information created or edited by the user through graphic elements, including corresponding button graphics, button names, and button descriptions. The button description is used to help the user determine the button functions, and the user can intuitively recognize and operate the buttons. By converting the terminal commands into visual graphical buttons, each command has a graphical button representation corresponding thereto, which can be intuitively recognized and operated by the user.
The command option is a parameter or key item required by the command to be configured, and can also be a section of script, and the option can be copied and pasted by a user or provided by a system, and the user only needs to select the option. The parameters required by the command to be configured refer to parameters directly attached to the command when the command is input, and the parameters are part of the command. For example, "-l" in the commands "ls-l" is a parameter required after a command for designating a file list to be displayed in a long format.
For example: when compiling kernel under the cluster system module, a terminal command build cluster kernel needs to be input into the terminal to be executed, and at this time, a user can set a command name as kernel, and a command option as build cluster kernel.
Content data of the button can be created for each button through step S110.
Step S120, adding event processing functions to the buttons based on the configuration files, and rendering the buttons according to the command options;
Specifically, the method can configure the command to be configured and the button based on VSCode to realize the visualization of the terminal command, VSCode is totally named Visual Studio Code, is a cross-platform free source code editor developed by Microsoft, is based on VSCode, can be installed based on cross-platform VSCode, and has portability.
According to the configuration file, an event processing function is added for each button in VSCode, the button is rendered according to the command option content corresponding to the button, and corresponding labels and icons are set for the button, so that a user can intuitively understand the functions of the button, and a visual entity of the button is created through step S120, and the event processing function is created for triggering when the user clicks.
Fig. 2 is a schematic diagram of a button rendering result in an embodiment of a visual execution method of a terminal command according to the present invention, as shown in fig. 2, after the button rendering is completed, the button rendering result will appear on the left side of the VSCode interface for a user to click.
Step S130, responding to the clicking event of the button, analyzing a command option corresponding to the button through the event processing function, and determining a command line grammar corresponding to the command to be configured;
Specifically, when the user clicks the button, because the button is rendered, an event function corresponding to the button can be triggered, and in response to the clicking event of the button, the event processing function parses all element contents in the button configured by the user, parses out a command corresponding to the button, and determines a command line grammar according to command options. For example, if the user sets the command name as kernel and the command option as build cluster kernel, the command line grammar can be assembled into build cluster kernel.
Step S140, executing the command line grammar;
Specifically, the command line syntax of the button is executed using a library function subprocess provided by the python language that executes the commands.
And step S150, calling up a terminal panel, and outputting an execution result of the command to be configured at the terminal panel.
Specifically, only the terminal command is executed in the previous step, and the terminal command is executed finally only after the terminal command execution result is displayed. In particular, a Terminal (Terminal) panel in VSCode may be invoked, in which the results of execution of the command are output and displayed on the interface.
Fig. 3 is a schematic diagram of a button execution result in an embodiment of a Terminal command visual execution method of the present invention, where, as shown in fig. 3, a left circled block diagram is a button group, and after all Terminal commands corresponding to the button group are executed, an execution result is output in a Terminal panel, and execution and display of the Terminal commands are implemented by clicking a button instead of inputting the Terminal commands. For complex tasks or operations requiring multiple command combinations to be performed, the user does not need to remember a series of commands and parameters, and can execute the corresponding commands by clicking a button without manually inputting the commands. In addition, the user can customize the buttons and options according to the requirements of the user to meet the requirements of specific tasks.
The visual execution method of the terminal command provided by the embodiment of the invention obtains the configuration file, wherein the configuration file comprises a command name, a button and a command option of a command to be configured; adding an event processing function to the button based on the configuration file, and rendering the button according to the command option; responding to the clicking event of the button, analyzing command options corresponding to the button through the event processing function, and determining command line grammar corresponding to the command to be configured; executing the command line grammar; and calling up a terminal panel, and outputting an execution result of the command to be configured at the terminal panel. According to the terminal command visual execution method provided by the embodiment of the invention, the terminal command is converted into the visual graphic buttons, each command is provided with the graphic buttons corresponding to the command, and a user can intuitively identify and operate the graphic elements, so that a more convenient and efficient terminal command execution mode is provided for the user, the working efficiency is improved, and the error rate is reduced.
On the basis of the foregoing embodiment, further, the acquiring the configuration file includes:
receiving a command name, a button and a command option of a command to be configured, which are input by a user;
Generating and storing a configuration file based on the command name, the button and the command option;
and acquiring the configuration file from a storage area.
In particular, an intuitive, easy-to-use interface may be provided to the user via VSCode, including various buttons and options to represent predefined terminal command combinations. The user can execute the corresponding command by clicking on these buttons and options without manually entering the command. In addition, the user can customize the buttons and options according to the requirements of the user to meet the requirements of specific tasks. In specific implementation, an fs module in node js can be used to store configuration command data of a user into a local JSON file to obtain a configuration file, wherein the node js is an open-source and cross-platform JavaScript runtime environment, and a developer is allowed to construct a high-performance and extensible network application program at a server side by using JavaScript language based on a Chrome V8 engine. fs (file system) is a module of node. Js for handling read and write operations of files and directories.
When the configuration file is needed, the fs module in the node js is used for loading the local user configuration command data JSON file, and the configuration file input by the user can be obtained.
In the embodiment of the invention, the user can complete the construction and execution of the command by visual interface operation without memorizing complicated command grammar and parameter options.
On the basis of the above embodiments, further, the receiving the command name, the button, the command option and the command parameter of the command to be configured, which are input by the user, includes:
Determining a button of a command to be configured in response to a button selected by a user;
Determining a command name of a command to be configured in response to a command name input by a user;
in response to a command option entered or selected by a user, a command option for a command to be configured is determined.
Specifically, fig. 4 is a schematic diagram of a button configuration interface in an embodiment of a terminal command visual execution method of the present invention, as shown in fig. 4, a user may open a command editing visual interface in VSCode, and the user may create and edit a visual representation of the command by using the interface, and the editor provides a rich graphic element library including common commands, parameters, options, and the like. The user creates or edits the buttons, selects the corresponding button graphics, names, descriptions, and can intuitively identify and operate these graphical elements. The user adds visual parameter settings, set commands, parameter values and selectable items to the buttons, such as adding groups for buttons, setting names, entering command scripts, etc.
In practical application, the user can configure the interface selection button graph at the Task instruction VSCode, describe the button colors, set the button groups, set the button contents, and display the button contents for the user to refer to the button functions when the cursor is placed in the button range. The user can edit or delete buttons on the instruction configuration interface, wherein the edit buttons comprise new buttons or modified button information. The button of the command to be configured is determined based on the button selected by the user. Then, the user may input the name of the command or the command group, and determine the command name of the command to be configured based on the command name input by the user. For command options, a user can select to input, can also select from selectable options provided by the system, and determines the command option of a command to be configured based on the command option input or selected by the user, wherein the user can manually input the customized command option, and the command option is grammar information required for executing the command, such as an execution script of the command, and the like.
In the embodiment of the invention, the user can complete the construction and execution of the command by visual interface operation without memorizing complicated command grammar and parameter options.
On the basis of the above embodiments, further, in response to the command option input by the user, determining the command option of the command to be configured includes:
responding to a user input command option, and determining a command name and a command option of a secondary command corresponding to the command to be configured;
responding to the command option of the secondary command, and continuing to determine the command name and the command option of the tertiary command corresponding to the secondary command until the termination condition is met;
And associating the command names and command options of all commands as command options of the commands to be configured.
In particular, for operations requiring multiple command combinations to be performed, users often need to remember a series of commands and parameters, which can lead to input errors or waste time, adding a heavy instruction memory burden to the user. To solve this problem, in the embodiment of the present invention, all services managed by the command option configured by the user may be automatically acquired for the command option.
For the business options input by the user, receiving the command options input by the user, executing the "- -hellp" options of the commands to obtain the command names and the option parameters of the secondary commands of the user, and for each secondary command, obtaining the command names and the option parameters of the tertiary commands in the same way, and continuing to generate command data. This process may be performed recursively until a termination condition is met, such as reaching a desired level or no more selectable parameters. And saving the generated command data into a local JSON file as all command options associated with the commands input by the user.
The option parameters of the command are obtained by automatically parsing the "- -hellp" option of the command and recursively applied to the command at multiple levels. Thus, the user can easily acquire and construct the complete command set, and all command sets of the commands can be generated without manually inputting each command and the corresponding option parameters.
For example, the user enters a command: the "build tool-hellp" executes instructions using the library function subprocess of the execute command provided by the python language to obtain the secondary command selectable parameters of the "build tool".
For example, the returned selectable parameters may be: "compiled code", "packaged application", "release version", and the like.
Continuing to execute the secondary command based on the return: the "build tool compiles code- -hellp" and obtains selectable parameters of "compiled code".
For example, the returned selectable parameters may be: source code path, target path, compilation options, etc.
Continuing to execute the tertiary command based on the return: the "build tool compiles code- -source code path" get "- -optional value parameters of the source code path".
Continue executing the four-level command or the like … … according to the returned result
Through the steps, the system generates corresponding command data according to the selection of a user, for example, a command for automatically executing compiling operation, and the generated command data can be stored in a local JSON file.
In the embodiment of the invention, in the configuration interface, the command set is automatically generated through the command selection input by the user, so that the operation time and the workload of the user are effectively reduced.
On the basis of the above embodiments, further, in response to the command option selected by the user, determining the command option of the command to be configured includes:
acquiring all commands associated with the command options;
and associating the command options selected by the user with all the associated commands, and determining the command options corresponding to the commands to be configured.
In particular, for operations requiring multiple command combinations to be performed, users often need to remember a series of commands and parameters, which can lead to input errors or waste time, adding a heavy instruction memory burden to the user. To solve this problem, in the embodiment of the present invention, all services managed by the service option may be automatically acquired for the service option configured by the user.
For service selectable items provided by the system, selectable item parameters of the command can be obtained in advance through automatically analyzing the 'hellp' item of the command, and recursively applied to the commands of multiple levels.
After a command option is selected by a user, all commands associated with the command option are acquired, the command option is associated with all commands managed, and a command set corresponding to the commands to be configured is determined.
In the embodiment of the invention, the command set is pre-associated by the system, so that the user can easily acquire and construct the complete command set when selecting the command selectable item without manual input, select one command, automatically associate the command set, generate all command sets of the command, and further reduce the operation time and workload of the user.
On the basis of the above embodiments, before generating the configuration file based on the command name, the button and the command option, the method further includes:
And verifying the command options according to a preset security verification method, and passing the verification.
Specifically, in order to prevent potential security vulnerabilities and malicious command execution, input verification and filtering are also required for command options input by a user, specifically, preset security verification modes such as regular expression, white list verification, parameter type check and the like can be used for verification, so that input commands and parameters are ensured to conform to expected formats and ranges. After the input verification and the filtering are passed, the fs module in the node. Js is used for storing the user configuration command data into the local JSON file.
For example, in an environment where the system does not allow copying, if the command option includes "copy", an alarm is popped up, and a button corresponding to the command cannot be generated.
The embodiment of the invention prevents potential security vulnerabilities and malicious command execution through input verification and filtering.
On the basis of the above embodiments, further, the configuration file further includes: command parameters of the command to be configured;
the responding to the clicking event of the button, analyzing the command options corresponding to the button through the event processing function, and determining the command line grammar corresponding to the command to be configured comprises the following steps:
And responding to the clicking event of the button, analyzing the command options and command parameters corresponding to the button through the event processing function, and assembling the command line grammar corresponding to the command to be configured.
Specifically, the command may further include a command parameter, where the command parameter refers to information that needs to be provided when the command is executed, and is used to specify an operation object or a behavior of the command.
For example, in the command git Commit-m "Commit message", git Commit is the command itself, and-m "Commit message" is a parameter required for command execution to specify a submitted message.
After the user selects the command button, inputs the command name, command options and command parameters, verifies the user input information, generates a command configuration file after verification is passed, adds event processing functions to the button based on the configuration file, and renders the button. When a user clicks a button, the event processing function analyzes command options and command parameters corresponding to the button, assembles a command line grammar corresponding to a command to be configured, then executes the command line grammar, calls up a terminal panel, and outputs an execution result of the command to be configured at the terminal panel.
For example, when compiling the script of the core engine E04 and compiling the boot under the android module, a command needs to be input sebuilder android boot in the terminal to be executed, a user can command to be sebuilder in the command editing visual page, command options are android, parameters are boot, and when assembling the command line grammar, the command line grammar can be assembled to be sebuilder android boot to be executed.
Fig. 5 is a flowchart illustrating steps of another embodiment of a method for visually executing a terminal command according to the present invention, as shown in fig. 5, the method includes the steps of:
Step A1, a user opens a command editing visual interface, a visual representation of the command is created and edited by using the interface, and an editor provides a rich graphic element library comprising common commands, parameters, options and the like.
And A2, creating or editing buttons by a user, and selecting corresponding button graphs, names and descriptions. The user can intuitively recognize and operate these graphic elements.
And A3, adding visual parameter setting, command setting, parameter values and selectable items to the buttons by a user.
And step A4, inputting verification and filtering, and ensuring that the commands and parameters input by the user are correctly verified and filtered so as to prevent potential security vulnerabilities and malicious command execution. Regular expressions, white list verification, parameter type checking, etc., are used to ensure that the entered commands and parameters conform to the expected format and scope.
And step A5, after the input verification and filtering are passed, storing user configuration command data into a local JSON file by using an fs module in a node.
And A6, loading a local user configuration command data JSON file by using an fs module in the node. Js, adding an event processing function for each button, rendering the buttons according to the data content, and setting corresponding labels and icons for the buttons so that a user can intuitively understand the functions of the buttons.
Step A7, A8, A9: when the user clicks a button, the js event processing function is triggered. The event processing function analyzes the element content selected by the user, analyzes the button command and parameters and assembles the command line grammar.
Step A10, executing the command line grammar assembled in the last step by using a library subprocess for executing commands provided by the python language.
And step A11, calling up VSCode a Terminal panel, and outputting the execution result of the command in the panel and displaying the result on an interface.
According to the terminal command visual execution method provided by the embodiment of the invention, based on the plug-in developed by VSCode, the terminal command can be installed based on the cross-platform VSCode, the terminal command is converted into visual graphic buttons, each command is provided with a graphic button representation corresponding to the terminal command, and a user can intuitively identify and operate the graphic elements. Therefore, the user does not need to memorize complex command grammar and parameter options, and can complete the construction and execution of the command only through visual interface operation. The method provides a more convenient and efficient terminal command execution mode for users, improves the working efficiency and reduces the error rate.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 6, a block diagram of an embodiment of a terminal command visualization execution device according to the present invention is shown, and may specifically include the following modules:
An obtaining module 610, configured to obtain a configuration file, where the configuration file includes a command name, a button, and a command option of a command to be configured;
An event adding module 620, configured to add an event processing function to the button based on the configuration file, and render the button according to the command option;
The assembling module 630 is configured to respond to the clicking event of the button, parse the command option corresponding to the button through the event processing function, and determine the command line grammar corresponding to the command to be configured;
An execution module 640 for executing the command line grammar;
And the output module 650 is configured to call up a terminal panel, and output an execution result of the command to be configured on the terminal panel.
As in the above apparatus, optionally, the obtaining module 610 includes:
The receiving unit is used for receiving a command name, a button and a command option of a command to be configured, which are input by a user;
The generating unit is used for generating and storing a configuration file based on the command name, the button and the command options;
and the acquisition unit is used for acquiring the configuration file from the storage area.
The above device, optionally, the receiving unit is specifically configured to:
Determining a button of a command to be configured in response to a button selected by a user;
Determining a command name of a command to be configured in response to a command name input by a user;
in response to a command option entered or selected by a user, a command option for a command to be configured is determined.
The above device, optionally, the receiving unit is specifically configured to:
responding to a user input command option, and determining a command name and a command option of a secondary command corresponding to the command to be configured;
responding to the command option of the secondary command, and continuing to determine the command name and the command option of the tertiary command corresponding to the secondary command until the termination condition is met;
And associating the command names and command options of all commands as command options of the commands to be configured.
The above device, optionally, the receiving unit is specifically configured to:
acquiring all commands associated with the command options;
and associating the command options selected by the user with all the associated commands, and determining the command options corresponding to the commands to be configured.
The apparatus as above, optionally, further comprising:
and the verification module is used for verifying the command options according to a preset security verification method and passing the verification before generating the configuration file based on the command name, the button and the command options.
The above device, optionally, the preset security verification method includes:
regular expression, white list verification, or parameter type checking.
The above apparatus, optionally, the configuration file further includes: command parameters of the command to be configured;
The assembly module 630 is specifically configured to:
And responding to the clicking event of the button, analyzing the command options and command parameters corresponding to the button through the event processing function, and assembling the command line grammar corresponding to the command to be configured.
For the device embodiment, since the device embodiment is substantially similar to the method embodiment, the description is relatively simple, and the relevant points only need to be referred to the part of the description of the method embodiment, which is not repeated herein.
Referring to fig. 7, there is shown a block diagram of an embodiment of an electronic device of the present invention, the device comprising: a processor (processor) 710, a memory (memory) 720, and a bus 730;
Wherein processor 710 and memory 720 communicate with each other via bus 730;
Processor 710 is configured to invoke program instructions in memory 720 to perform the methods provided by the method embodiments described above, including, for example: acquiring a configuration file, wherein the configuration file comprises a command name, a button and a command option of a command to be configured; adding an event processing function to the button based on the configuration file, and rendering the button according to the command option; responding to the clicking event of the button, analyzing command options corresponding to the button through the event processing function, and determining command line grammar corresponding to the command to be configured; executing the command line grammar; and calling up a terminal panel, and outputting an execution result of the command to be configured at the terminal panel.
Embodiments of the present invention disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the methods provided by the method embodiments described above, for example comprising: acquiring a configuration file, wherein the configuration file comprises a command name, a button and a command option of a command to be configured; adding an event processing function to the button based on the configuration file, and rendering the button according to the command option; responding to the clicking event of the button, analyzing command options corresponding to the button through the event processing function, and determining command line grammar corresponding to the command to be configured; executing the command line grammar; and calling up a terminal panel, and outputting an execution result of the command to be configured at the terminal panel.
Embodiments of the present invention provide a non-transitory computer readable storage medium storing computer instructions that cause a computer to perform the methods provided by the above-described method embodiments, for example, including: acquiring a configuration file, wherein the configuration file comprises a command name, a button and a command option of a command to be configured; adding an event processing function to the button based on the configuration file, and rendering the button according to the command option; responding to the clicking event of the button, analyzing command options corresponding to the button through the event processing function, and determining command line grammar corresponding to the command to be configured; executing the command line grammar; and calling up a terminal panel, and outputting an execution result of the command to be configured at the terminal panel.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or terminal device that comprises the element.
The above detailed description of the terminal command visual execution method, the terminal command visual execution device, the electronic device and the storage medium provided by the invention applies specific examples to illustrate the principle and the implementation of the invention, and the above examples are only used for helping to understand the method and the core idea of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (11)

1. A terminal command visualization execution method, comprising:
acquiring a configuration file, wherein the configuration file comprises a command name, a button and a command option of a command to be configured;
Adding an event processing function to the button based on the configuration file, and rendering the button according to the command option;
Responding to the clicking event of the button, analyzing command options corresponding to the button through the event processing function, and determining command line grammar corresponding to the command to be configured;
executing the command line grammar;
And calling up a terminal panel, and outputting an execution result of the command to be configured at the terminal panel.
2. The method of claim 1, wherein the obtaining the configuration file comprises:
receiving a command name, a button and a command option of a command to be configured, which are input by a user;
Generating and storing a configuration file based on the command name, the button and the command option;
and acquiring the configuration file from a storage area.
3. The method of claim 2, wherein receiving the command name, button, command option, and command parameter of the command to be configured entered by the user comprises:
Determining a button of a command to be configured in response to a button selected by a user;
Determining a command name of a command to be configured in response to a command name input by a user;
in response to a command option entered or selected by a user, a command option for a command to be configured is determined.
4. A method according to claim 3, wherein determining a command option for a command to be configured in response to a command option entered by a user comprises:
responding to a user input command option, and determining a command name and a command option of a secondary command corresponding to the command to be configured;
responding to the command option of the secondary command, and continuing to determine the command name and the command option of the tertiary command corresponding to the secondary command until the termination condition is met;
And associating the command names and command options of all commands as command options of the commands to be configured.
5. A method according to claim 3, wherein determining a command option for a command to be configured in response to a user selected command option comprises:
acquiring all commands associated with the command options;
and associating the command options selected by the user with all the associated commands, and determining the command options corresponding to the commands to be configured.
6. The method of claim 2, wherein prior to generating a configuration file based on the command name, button, and command option, further comprising:
And verifying the command options according to a preset security verification method, and passing the verification.
7. The method of claim 6, wherein the preset security verification method comprises:
regular expression, white list verification, or parameter type checking.
8. The method of any of claims 1-7, wherein the configuration file further comprises: command parameters of the command to be configured;
the responding to the clicking event of the button, analyzing the command options corresponding to the button through the event processing function, and determining the command line grammar corresponding to the command to be configured comprises the following steps:
And responding to the clicking event of the button, analyzing the command options and command parameters corresponding to the button through the event processing function, and assembling the command line grammar corresponding to the command to be configured.
9. A terminal command visualization execution device, characterized by comprising:
the system comprises an acquisition module, a configuration module and a control module, wherein the acquisition module is used for acquiring a configuration file, and the configuration file comprises a command name, a button and a command option of a command to be configured;
The event adding module is used for adding event processing functions for the buttons based on the configuration files and rendering the buttons according to the command options;
The assembling module is used for responding to the clicking event of the button, analyzing the command options corresponding to the button through the event processing function and determining the command line grammar corresponding to the command to be configured;
An execution module for executing the command line grammar;
and the output module is used for calling up a terminal panel and outputting an execution result of the command to be configured on the terminal panel.
10. An electronic device, comprising:
The device comprises a memory and a processor, wherein the processor and the memory are communicated with each other through a bus; the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any of claims 1-8.
11. A computer readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the method according to any one of claims 1 to 8.
CN202410229882.2A 2024-02-29 2024-02-29 Visual execution method and device for terminal command, electronic equipment and storage medium Pending CN118051218A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410229882.2A CN118051218A (en) 2024-02-29 2024-02-29 Visual execution method and device for terminal command, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410229882.2A CN118051218A (en) 2024-02-29 2024-02-29 Visual execution method and device for terminal command, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN118051218A true CN118051218A (en) 2024-05-17

Family

ID=91047926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410229882.2A Pending CN118051218A (en) 2024-02-29 2024-02-29 Visual execution method and device for terminal command, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN118051218A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118540426A (en) * 2024-07-26 2024-08-23 山东捷瑞数字科技股份有限公司 Method, system, device and medium for one-key copy nested composition in video

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118540426A (en) * 2024-07-26 2024-08-23 山东捷瑞数字科技股份有限公司 Method, system, device and medium for one-key copy nested composition in video

Similar Documents

Publication Publication Date Title
US10572360B2 (en) Functional behaviour test system and method
US7636897B2 (en) System and method for property-based focus navigation in a user interface
US7861177B2 (en) Software configuration program for software applications
CN108351764B (en) Data processing method and system
US9535821B1 (en) Displaying violated coding rules in source code
US6757889B1 (en) Source program checking device and program and method for same
EP1139216A2 (en) Web application development system
US20080127060A1 (en) Dynamic mating of a modified user interface with pre-modified user interface code library
US8650532B2 (en) Change notification and information update based on uncompiled software development project
CN118051218A (en) Visual execution method and device for terminal command, electronic equipment and storage medium
CN109408354B (en) Data processing method and device for application component
Freeman Essential TypeScript 5
US8707269B1 (en) Dynamic test generation based on entities in a graphical environment
KR20080043345A (en) Declaratively defined control actions
US11042421B1 (en) Modifying system-defined user interface control functionality on a computing device
WO2017214665A1 (en) Improvements in or relating to forms
US20240020350A1 (en) Method and system for navigation control
JPH06348766A (en) Method and device for incorporating tool
CN114356783A (en) Method and device for automatically generating unit test code, storage medium and equipment
US20040194022A1 (en) Kernel configuration tool
CN112068895A (en) Code configuration method and device, video playing equipment and storage medium
JP5540856B2 (en) Apparatus and method for setting a workflow
Jöhnk Structure-based editing for SCCharts
CN112199097B (en) Installation package generation method, installation package generation device, computer equipment and storage medium
JP2809048B2 (en) Screen debugging method

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