A method, device and storage medium for generating prompt information

By obtaining and calling prompt command information in Git configuration file, we ensure that the latest code and updated version number are merged when the code is launched, the problem of missing the code that has been launched is solved and development efficiency is improved.

CN113778478BActive Publication Date: 2025-02-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011237445.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-09
Publication Date
2025-02-21
Estimated Expiration
2040-11-09

AI Technical Summary

Technical Problem

When multiple people develop multiple requirements in parallel, they may miss the merger of code branches that have been launched or modify the version number, resulting in the online project lacking the branch code that has been launched, reducing development efficiency.

Method used

By obtaining the prompt command information in the configuration file carried by the pending code, and calling these prompt command information when performing the online operation, it is displayed on the front end, requiring the developer to confirm whether to merge the latest code and updated version number, and generate the resubmit prompt information to Ensure operational integrity.

Benefits of technology

It effectively avoids the problem of missing the code that has been launched when the code is launched, improves development efficiency and reduces online accidents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113778478B_ABST
    Figure CN113778478B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device and storage medium for generating prompt information, specifically, first obtaining a configuration file carried by the code to be processed, secondly, when executing the development command information of the code to be processed, obtaining the prompt command information in the configuration file, further, when executing the online operation for the code to be processed, calling the prompt command information, and displaying the prompt command information on the front end, finally, based on the operation information corresponding to the prompt command information obtained on the front end, judging the operation status of the code to be processed, and generating the resubmission prompt information corresponding to the code to be processed when the operation status is a failed state. The embodiment of the present application prompts developers by calling the relevant prompt command information when the code is online and displaying it on the front end, thereby improving development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device and storage medium for generating prompt information. Background Art

[0002] GIt is an open source distributed version control system that is used to handle any small or large project in an agile and efficient manner. In the daily development of a project, if there are multiple requirements in parallel, it is generally necessary to create multiple branches for development. When the code to be launched is saved to the master branch, the online system can extract the code to be launched from the master branch to complete the launch. When multiple people develop multiple requirements in parallel, multiple branches are generally created for development. If there are parallel development requirements for branches A and B, after branch A is launched, when branch B is launched, it is generally necessary to merge the A branch code that has been launched and change the version number of the online resource (the version number is changed to ensure that users access the new resource path after the launch, so as to ensure that users access the latest code), and then submit it to the master branch for online. However, manual execution of the above operations may forget to merge code branches or modify version numbers, resulting in the lack of branch code that has been launched in the online project, reducing development efficiency. Summary of the invention

[0003] The embodiment of the present application provides a method for generating prompt information, which overcomes the problem of missing the online code when putting the code online, resulting in low development efficiency.

[0004] The method includes:

[0005] Get the configuration file carried by the code to be processed;

[0006] When executing the development command information of the code to be processed, obtaining the prompt command information in the configuration file;

[0007] When the online operation is performed for the code to be processed, the prompt command information is called and the prompt command information is displayed on the front end;

[0008] Based on the operation information corresponding to the prompt command information obtained at the front end, the operation status of the code to be processed is judged, and when the operation status is a failed state, resubmission prompt information corresponding to the code to be processed is generated.

[0009] Optionally, the configuration file is created in the root directory of the code library where the code to be processed is located, wherein the configuration file includes the prompt command information corresponding to the code to be processed.

[0010] Optionally, the acquired prompt command information is written into a hook file in the code library, the hook file is triggered when the online operation is executed for the code to be processed, and the online operation is stopped to call the prompt command information in the hook file.

[0011] Optionally, based on the operation information corresponding to the prompt command information obtained by the front end, when at least one of the operation information is the first information, the operation status of the code to be processed is determined to be the failed status, and when all of the operation information is the second information, the operation status of the code to be processed is determined to be the submittable status.

[0012] In another embodiment of the present invention, a device for generating prompt information is provided, the device comprising:

[0013] A first acquisition module is used to acquire a configuration file carried by the code to be processed;

[0014] A second acquisition module is used to acquire the prompt command information in the configuration file when executing the development command information of the code to be processed;

[0015] A calling module, used for calling the prompt command information when performing an online operation for the code to be processed, and displaying the prompt command information on the front end;

[0016] A generation module is used to determine the operation status of the code to be processed based on the operation information corresponding to the prompt command information obtained at the front end, and generate resubmission prompt information corresponding to the code to be processed when the operation status is a failed state.

[0017] Optionally, the device further comprises:

[0018] A creation module is used to create the configuration file in the root directory of the code library where the code to be processed is located, wherein the configuration file contains the prompt command information corresponding to the code to be processed.

[0019] Optionally, the device further comprises:

[0020] A trigger module is used to write the acquired prompt command information into a hook file in the code library, trigger the hook file when executing the online operation for the code to be processed, and stop executing the online operation to call the prompt command information in the hook file.

[0021] Optionally, the generating module is further used for:

[0022] Based on the operation information corresponding to the prompt command information obtained by the front end, when at least one of the operation information is the first information, the operation status of the code to be processed is determined to be the failed status, and when all of the operation information is the second information, the operation status of the code to be processed is determined to be the submittable status.

[0023] In another embodiment of the present invention, a non-transitory computer-readable storage medium is provided, wherein the non-transitory computer-readable storage medium stores instructions, and when the instructions are executed by a processor, the processor executes each step in the above-mentioned method for generating prompt information.

[0024] In another embodiment of the present invention, a terminal device is provided, including a processor, wherein the processor is configured to execute each step in the above-mentioned method for generating prompt information.

[0025] Based on the above embodiment, firstly, the configuration file carried by the code to be processed is obtained. Secondly, when the development command information of the code to be processed is executed, the prompt command information in the configuration file is obtained. Furthermore, when the online operation is performed for the code to be processed, the prompt command information is called and the prompt command information is displayed on the front end. Finally, based on the operation information corresponding to the prompt command information obtained on the front end, the operation status of the code to be processed is judged, and when the operation status is a failed state, the resubmission prompt information corresponding to the code to be processed is generated. The embodiment of the present application prompts developers and improves development efficiency by calling relevant prompt command information when the code is online and displaying it on the front end. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 A flow chart of a method for generating prompt information provided in Embodiment 100 of the present application is shown;

[0028] Figure 2 A schematic diagram showing a specific process of a method for generating prompt information provided by embodiment 200 of the present application;

[0029] Figure 3 A schematic diagram showing that the embodiment 300 of the present application also provides a device for generating prompt information;

[0030] Figure 4A schematic diagram of a terminal device provided in embodiment 400 of the present application is shown. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0032] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the implementation of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0033] Based on the problems in the prior art, an embodiment of the present application provides a method for generating prompt information, which is mainly applicable to the field of computer technology. By using the git-hook technology to call the prompt command information, and combining with nodejs to implement the function of providing relevant prompts when submitting the online code on the master branch, the developer can stop and review whether to merge the latest code, update the version number, etc. at the moment of submitting the code for the last time, so as to reduce online accidents. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. Figure 1 FIG. 1 is a flow chart of a method for generating prompt information provided by embodiment 100 of the present application. The detailed steps are as follows:

[0034] Step S11, obtaining the configuration file carried by the code to be processed.

[0035] In this step, the pending code in the embodiment of the present application is the pending code downloaded from the Git library for further development locally. Among them, the Git library is an open source distributed version control system for agile and efficient processing of any small or large project. When downloading and obtaining the pending code, the configuration file in the root directory of the project package to which the pending code belongs is obtained at the same time. The configuration file stores prompt command information for developers to provide development prompts.

[0036] Step S12, when executing the development command information of the code to be processed, obtaining the prompt command information in the configuration file.

[0037] In this step, for the downloaded code to be processed, the local server is started to execute the development command information for developing the code to be processed. Further, the prompt command information in the configuration file is obtained.

[0038] Step S13, when the online operation is performed for the code to be processed, the prompt command information is called and the prompt command information is displayed on the front end.

[0039] In this step, when the developer performs the online operation on the master branch, the call prompt command information is triggered, the online operation of the code to be processed is intercepted, and the prompt command information is displayed on the front end.

[0040] Step S14, based on the operation information corresponding to the prompt command information obtained at the front end, the operation status of the code to be processed is determined, and when the operation status is a failed state, resubmission prompt information corresponding to the code to be processed is generated.

[0041] In this step, the developer inputs the operation information corresponding to the prompt command information on the front end based on the prompt command information displayed on the front end. Further, based on the type and quantity of the obtained operation information, the operation status of the pending code is determined. The operation status of the pending code includes a failed state and a submittable state. When the operation status is a failed state, a resubmission prompt information corresponding to the pending code is generated to enable the developer to recheck and submit the pending code.

[0042] As described above, based on the above embodiments, firstly, the configuration file carried by the code to be processed is obtained, and secondly, when the development command information of the code to be processed is executed, the prompt command information in the configuration file is obtained, and further, when the online operation is performed for the code to be processed, the prompt command information is called, and the prompt command information is displayed on the front end, and finally, based on the operation information corresponding to the prompt command information obtained on the front end, the operation status of the code to be processed is judged, and when the operation status is a failed state, the resubmission prompt information corresponding to the code to be processed is generated. The embodiment of the present application prompts developers by calling the relevant prompt command information when the code is online and displaying it on the front end, thereby improving development efficiency.

[0043] like Figure 2 As shown, it is a schematic diagram of a specific process of a method for generating prompt information provided by embodiment 200 of the present application. The detailed process of the specific process is as follows:

[0044] S201, create a configuration file.

[0045] Here, a configuration file is created in the root directory of the code library where the code to be processed is located, wherein the configuration file contains prompt command information corresponding to the code to be processed. Specifically, the user creates a new configuration file in the root directory to customize the prompt questions to be displayed on the front end. The prompt command information can be a selection type or a yes / no type or a type of information that requires input from the developer.

[0046] S202, obtaining a configuration file carried by the code to be processed.

[0047] Here, in each business project packaged by webpack, when executing the development command information npm run dev for starting the local server to develop the project, if we stipulate that the command to generate the prompt command information is preCommit, add this command when executing npm run dev in each business project. Furthermore, when executing npm run dev, start the preCommit command.

[0048] S203, obtaining prompt command information in the configuration file.

[0049] Here, the preCommit command is used to obtain the prompt command information in the configuration file.

[0050] S204, generating a hook file.

[0051] Here, the obtained prompt command information is written into the hook file in the code library. Specifically, the code corresponding to the prompt command information is written into the hook file, i.e., . / git / hook / pre-commit file, using nodejs technology. Among them, . / git / hook is a hidden folder that exists by default in the Git library. The generated hook file will be executed when the code to be processed is submitted.

[0052] S205, determining whether the Git branch where the code to be processed is located is a master branch.

[0053] Here, when it is not the master branch, the interception operation on the pending code is not performed, and the pending code is submitted to the Git staging area.

[0054] S206, calling prompt command information.

[0055] Here, when the Git branch where the pending code is located is the master branch, it can be confirmed that the pending code needs to be put online. Furthermore, the hook file is triggered when the online operation is performed for the pending code, and the online operation is stopped to intercept the pending code to call the prompt command information in the hook file. Since a business project uses the same hook file, the prompt command information is saved even if it is switched to the master branch. When the user performs the online operation, i.e. git commit-m'update', to submit the pending code to the temporary storage area of ​​the Git library, the hook file will be automatically triggered, and the readline-sync module of nodejs will be used to call the prompt command information in the hook file.

[0056] S207, displaying the prompt command information on the front end.

[0057] Here, prompt command information such as "Is the online version number correct?", "Has the main branch code been merged?", etc., prompts developers. At the same time, each prompt command information is added with selection type or yes / no type or confirmation information that requires developer input.

[0058] S208, monitoring the operation information inputted at the front end.

[0059] Here, after viewing the prompt command information on the front end, the developer selects or enters the corresponding operation information, and uses the readline-sync module of nodejs to obtain the operation information corresponding to the prompt command information on the front end.

[0060] S209, determining the operation status of the code to be processed.

[0061] Here, the operation status of the code to be processed is determined based on the type and quantity of the acquired operation information, wherein the operation status of the code to be processed includes a failed status and a submittable status.

[0062] S210: When the operation status is a failed status, a resubmission prompt message corresponding to the code to be processed is generated.

[0063] Here, if at least one of the monitored operation information is the first information, the operation status of the pending code is determined to be a failed status. Specifically, if the first information is negative information, and at least one of the operation information is negative information, process.exit(1) is executed to exit the current process, stop submitting the pending code to the temporary storage area in the Git repository, and generate a resubmission prompt information corresponding to the pending code to remind the developer to repackage and submit the pending code.

[0064] S211, when the operation status is a committable status, submit the pending code to the temporary storage area in the Git repository.

[0065] In this step, if the monitored operation information is all the second information indicating the confirmation answer, it is determined that the operation state of the code to be processed is a submittable state. Further, process.exit(0) is executed to submit the code to be processed to the Git temporary storage area.

[0066] This application implements the above-mentioned method of generating prompt information based on the above steps. Through the configuration file where the prompt command information customized by the developer is located, when executing the development command information, the prompt command information in the hook file . / git / hook / pre-commit file is triggered by using the readline-sync module of nodejs, and when executing the online operation git commit-m'update' of the pending code, the prompt command information in the . / git / hook / pre-commit file is executed, so that the prompt question is displayed on the front end. Only after the user and the developer choose to confirm can the pending code be successfully submitted. Furthermore, the readline-sync module and preCommit technology are used to complete the automatic prompt function before submitting the pending code.

[0067] The embodiment of the present application uses git-hook technology and combines it with nodejs to implement the function of providing relevant prompts when submitting code that needs to be put online on the master branch. In this way, developers can stop and review whether to merge the latest code, update the version number, etc. at the moment of submitting the code for the last time, thereby reducing online accidents and improving development efficiency.

[0068] Based on the same inventive concept, the embodiment 300 of the present application also provides a device for generating prompt information, wherein, Figure 3 As shown, the device comprises:

[0069] A first acquisition module 31 is used to acquire a configuration file carried by the code to be processed;

[0070] The second acquisition module 32 is used to acquire the prompt command information in the configuration file when executing the development command information of the code to be processed;

[0071] The calling module 33 is used to call the prompt command information when the online operation is performed for the code to be processed, and display the prompt command information on the front end;

[0072] The generating module 34 is used to determine the operation status of the code to be processed based on the operation information corresponding to the prompt command information obtained at the front end, and generate resubmission prompt information corresponding to the code to be processed when the operation status is a failed state.

[0073] In this embodiment, the specific functions and interaction methods of the first acquisition module 31, the second acquisition module 32, the calling module 33 and the generating module 34 can be found in Figure 1 The description of the corresponding embodiments will not be repeated here.

[0074] Optionally, the device further comprises:

[0075] The creation module 35 is used to create a configuration file in the root directory of the code library where the code to be processed is located, wherein the configuration file contains prompt command information corresponding to the code to be processed.

[0076] Optionally, the device further comprises:

[0077] The trigger module 36 is used to write the acquired prompt command information into the hook file in the code library, trigger the hook file when executing the online operation for the code to be processed, and stop executing the online operation to call the prompt command information in the hook file.

[0078] Optionally, the generating module 34 is further used for:

[0079] Based on the operation information corresponding to the prompt command information obtained by the front end, when at least one operation information is the first information, the operation status of the code to be processed is determined to be a failed status, and when all operation information is the second information, the operation status of the code to be processed is determined to be a submittable status.

[0080] like Figure 4 As shown, another embodiment 400 of the present application further provides a terminal device, including a processor 401, wherein the processor 401 is used to execute the steps of the above-mentioned method for generating prompt information. Figure 4 It can also be seen that the terminal device provided in the above embodiment also includes a non-transient computer-readable storage medium 402, on which a computer program is stored, and when the computer program is executed by the processor 401, the steps of the above method for generating prompt information are executed. In practical applications, the terminal device can be one or more computers, as long as it includes the above computer-readable medium and processor.

[0081] Specifically, the storage medium can be a general storage medium, such as a mobile disk, a hard disk, and FLASH, etc. When the computer program on the storage medium is run, each step in the above-mentioned method for generating prompt information can be executed. In practical applications, the computer-readable medium can be included in the device / apparatus / system described in the above embodiments, or it can exist independently without being assembled into the device / apparatus / system. The above-mentioned computer-readable storage medium carries one or more programs, and when the above-mentioned one or more programs are executed, each step in the above-mentioned method for generating prompt information can be executed.

[0082] According to the embodiments disclosed in the present application, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof, but it is not used to limit the scope of protection of the present application. In the embodiments disclosed in the present application, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0083] The flow chart and block diagram in the accompanying drawings of the present application show the possible architecture, function and operation of the system, method and computer program product according to the various embodiments disclosed in the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the box can also occur in the order marked in different drawings. For example, the boxes represented by two connections can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0084] Those skilled in the art will appreciate that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present application. In particular, without departing from the spirit and teachings of the present application, the features described in the various embodiments and / or claims of the present application may be combined and / or combined in a variety of ways, and all of these combinations and / or combinations fall within the scope disclosed in the present application.

[0085] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still change the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these changes, modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for generating prompt information, characterized in that: include: Get the configuration file carried by the code to be processed; When executing the development command information of the code to be processed, obtaining the prompt command information in the configuration file; When the online operation is performed for the code to be processed, the prompt command information is called and the prompt command information is displayed on the front end; Based on the operation information corresponding to the prompt command information obtained at the front end, determine the operation status of the code to be processed, and generate resubmission prompt information corresponding to the code to be processed when the operation status is a failed state; Wherein, between the step of obtaining the prompt command information in the configuration file and the step of calling the prompt command information, the method further comprises: The acquired prompt command information is written into a hook file in a code library, the hook file is triggered when the online operation is executed for the code to be processed, and the online operation is stopped to call the prompt command information in the hook file.

2. The method according to claim 1, characterized in that Before the step of obtaining the configuration file carried by the code to be processed, the method further comprises: The configuration file is created in the root directory of the code library where the code to be processed is located, wherein the configuration file includes the prompt command information corresponding to the code to be processed.

3. The method according to claim 1, characterized in that The step of determining the operation status of the code to be processed comprises: Based on the operation information corresponding to the prompt command information obtained by the front end, when at least one of the operation information is the first information, the operation status of the code to be processed is determined to be the failed status, and when all of the operation information is the second information, the operation status of the code to be processed is determined to be the submittable status.

4. A device for generating prompt information, characterized in that: include: A first acquisition module is used to acquire a configuration file carried by the code to be processed; A second acquisition module is used to acquire the prompt command information in the configuration file when executing the development command information of the code to be processed; A calling module, used for calling the prompt command information when performing an online operation for the code to be processed, and displaying the prompt command information on the front end; A generating module, configured to determine the operation status of the code to be processed based on the operation information corresponding to the prompt command information obtained at the front end, and generate resubmission prompt information corresponding to the code to be processed when the operation status is a failed state; A trigger module is used to write the acquired prompt command information into a hook file in a code library, trigger the hook file when executing the online operation for the code to be processed, and stop executing the online operation to call the prompt command information in the hook file.

5. The device according to claim 4, characterized in that The device further comprises: A creation module is used to create the configuration file in the root directory of the code library where the code to be processed is located, wherein the configuration file contains the prompt command information corresponding to the code to be processed.

6. The device according to claim 4, characterized in that The generation module is also used for: Based on the operation information corresponding to the prompt command information obtained by the front end, when at least one of the operation information is the first information, the operation status of the code to be processed is determined to be the failed status, and when all of the operation information is the second information, the operation status of the code to be processed is determined to be the submittable status.

7. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores instructions, which, when executed by a processor, enable the processor to perform each step in the method for generating prompt information as claimed in any one of claims 1 to 3.

8. A terminal device, characterized in that: The method comprises a processor, wherein the processor is used to execute each step in the method for generating prompt information according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method for prompting codes and device

    CN102520966A

  • A method and server for managing software version information

    CN109086071A