CN109508184A - The method of edit object is browsed in a kind of order line - Google Patents

The method of edit object is browsed in a kind of order line Download PDF

Info

Publication number
CN109508184A
CN109508184A CN201710829138.6A CN201710829138A CN109508184A CN 109508184 A CN109508184 A CN 109508184A CN 201710829138 A CN201710829138 A CN 201710829138A CN 109508184 A CN109508184 A CN 109508184A
Authority
CN
China
Prior art keywords
subpath
path
order
meant
parameter
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
CN201710829138.6A
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201710829138.6A priority Critical patent/CN109508184A/en
Publication of CN109508184A publication Critical patent/CN109508184A/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

Abstract

The present invention relates to a kind of methods that edit object is browsed in programmatics field more particularly to order line.The present invention devises a kind of method that edit object is browsed in order line, and the method for browsing edit object in the order line solves the problems, such as that common print object can not be shown whole in order line;Graceful heuristic navigation scheme is provided, any object in nodejs memory can be explored.It provides and is explored according to order, printed comprehensively, breviary printing, the browsing modes such as auto-browsing;It solves the problems, such as that memory object can not be changed when running in order line.The arbitrary fields of any object can be changed.Certainly, it to be used on appropriate opportunity;For various detail programmings, is safeguarded on server line, provide a kind of preferable solution, help to improve development efficiency, O&M debugging efficiency and content operation efficiency.

Description

The method of edit object is browsed in a kind of order line
Technical field
The present invention relates to a kind of methods that edit object is browsed in programmatics field more particularly to order line.
Background technique
In nodejs command line environment, if the content for being included inside an object is excessive, the depth of attribute is too deep, Will lead to can not see too deep content (being ignored) when order line printing, or look under general observe conditions See that particular content is very inconvenient.This problem is an essential problem.Because can be on the expansion depth theory of an object It is unlimited deep.If it all printed, name row can not be accommodated.Meanwhile it if being needed during nodejs operation It wants program to stop and changes the content of some object in real time in order line, existing method can not accomplish.
It is proposed that a kind of method of heuristic browsing edit object, can provide a kind of browsing side of interactive mode in this way Formula, so that the different piece of object, different depth level can be gradually unfolded.And user can be in the browsing of this interactive mode Oneself interested aspect is selected to be browsed in the process, it is not necessary to worry disposably to select can not find from excessive content The content oneself to be seen.Meanwhile the mode of the edit object of our offers, but also becoming when operation from order edlin object May, become the powerful approach safeguarded on detail programming and server line.
In order to solve the above-mentioned technical problem, the present invention devises a kind of method that edit object is browsed in order line, the life The method for browsing edit object in row is enabled to solve the problems, such as that common print object can not be shown whole in order line;It provides Graceful heuristic navigation scheme, can explore any object in nodejs memory.It provides and is visited according to order Rope prints comprehensively, breviary printing, the browsing modes such as auto-browsing;Memory object can not be changed when running in order line by solving The problem of.The arbitrary fields of any object can be changed.Certainly, it to be used on appropriate opportunity;For various detail programmings, service It is safeguarded on device line, provides a kind of preferable solution, help to improve development efficiency, O&M debugging efficiency and content operation Efficiency.
Summary of the invention
In order to overcome defect present in background technique, the technical solution adopted by the present invention to solve the technical problems is: The method of edit object is browsed in a kind of order line, it is characterised in that the steps include:
(1), firstly, realizing a REPL environment, that is, Read-Eval-Print-Loop in command line environment, this REPL environment can receive different Ordered Registrations, whenever knocking in different orders, can carry out the execution letter of the corresponding command Number can wait the input of user, receive new order again after execution terminates;
(2), following order is registered in REPL environment and its executes function:
1, pwd order is meant that the object path listed and be currently located;
2, cd order, parameter are subpath subpath, are meant that into specified path, if subpath is sky, for current road Diameter, if subpath is ' .. ' jumps to one layer of path, if subpath is ' ... ', jump to the road that browsing starts Diameter exports ' specified path is not present ' if specified path is not present;
3, ls order, parameter are subpath subpath, are meant that the expansion for listing the existing object seen under specified path can Can property, including the case where object class object and general object, the two are indicated with different colours, only list specified path, not into Enter the path;
4, v order, parameter are subpath subpath, be meant that in specified path object execute view operation, without into Enter the path, the meaning of View is exactly to print full content in the way of the print screen that js defaults;
5, vs order, parameter are subpath subpath, horizontal spreading width k, and longitudinal expansion depth h is meant that for specified Object in path carries out view_summary operation, and the meaning without entering the path, View_summary is exactly to utilize me The breviary mode that provides check that the meaning of this breviary mode is the subobject exhibition for each level for object It opens, K subobject before only printing, and recurrence is in this way, maximum depth of recursion is that K is defaulted as 5, H and is defaulted as 4, because js defaults Print screen mode at most only can show 4 layers of content;
6, keys order, parameter are subpath subpath, are meant that all keys for the object for listing specified path, are equivalent to ls + subpath;
7, values order, parameter are subpath subpath, are meant that all values for listing the object of specified path;For every A value calls the print screen mode of js default to report that the object is not object if the object is not object type Type;
8, auto-command, parameter are subpath subpath, are meant that the object for specified path, carry out auto-browsing auto Operation;Auto operation is meant, carries out breadth first traversal for object;For the object of each traversal, view_ is carried out Summary operation;And list the place path of each existing object;To realize all interior of the browsing object of automation Hold;Because this navigation process may be unlimited or super length;So providing the mode of secession of ctrl+C;
9, replace order, parameter are subpath subpath, and the content obj replaced with is meant that pair for specified path As completely being replaced;Replace with the object of obj;Root object can completely be replaced;
10, update order, parameter are subpath subpath, and the content obj of update is meant that the object for specified path, It is updated operation;Original content will not be replaced completely by updating operation, only so that being determined as being worth accordingly on corresponding key obj;
11, remove order, parameter are subpath subpath, are meant that the object for specified path, carry out delete operation, The path no longer exists after deletion.
Algorithm list: algorithm Main(R) stemming algorithms
Input: 1. according to the object of ObjectExplorer function entrance be R.
Prepare parameter: 2., which are arranged current path current_path, is " ".
Algorithm: 3. REPL take orders.If order are as follows:
' 4. pwd ': then printing the path current_path of existing object
5. ' cd+ subpath subpath ': then testing specified path with the presence or absence of (algorithm CheckPath (entrance object
R, current path current_path+ subpath subpath)).If it is present by current path current_ Path is set as current_path+ subpath.
6. ' ls+ subpath subpath ': test specified path whether there is.If it does, and its object be O, then arrange All keys (utilizing Object.keys (O)) for lifting O object are printed.Type is carried out for each value of these keys when printing Judgement.If its type is object, white is printed to, if it is other types, prints to blue.
7. ' v+ subpath subpath ': test specified path whether there is.If it does, and its object be O, then call System default printf console.log prints O object.
8. ' depth h ' is longitudinally unfolded in vs+ subpath subpath+ horizontal spreading width k+: whether test specified path is deposited ?.If it does, and its object be O, then call ViewSummary (O, k, h) algorithm carry out contrasted form printing.
9. ' keys+ subpath subpath ': being equivalent to ' ls+ subpath subpath ' order.
10. ' values+ subpath subpath ': test specified path whether there is.If it does, and its object be O, The all values for then enumerating O object (after obtaining all keys using Object.keys (O), carry out map on object O and are owned Values it) is printed.
11. ' auto+ subpath subpath ': test specified path whether there is.If it does, and its object be O, it is right Breadth first traversal is carried out in object O.For the object of each traversal, its place path (pwd) is listed, is carried out ViewSummary operation.
12. ' replace+ subpath subpath+ wishes the content obj ' replaced with: test specified path whether there is. If it does, and its object be O, then all keys of the object are emptied, each key-value pair of obj are then given to object O.
13. ' update+ subpath subpath+ wishes the content obj ' updated: test specified path whether there is.Such as Fruit exists, and its object is O, then each key-value pair of obj is given to object O, does not empty original key of O.
14. ' remove+ subpath subpath ': test specified path whether there is.If it does, and its object be O, Then delete the object.If subpath subpath be sky, that is, current path object be deleted, then using CheckPath (R, Path+' .. ') on jump level-one reach parent object, concurrently set existing object be parent object path.If it is entrance object R It is deleted, then jumps out repl, exit the program.
15. if jumping out repl encountering user in operation inputs ctrl+C order, exiting the program.
16. if REPL can be automatic do not execute completion for the case where any situation of the above 4-15 or above 4-14 3 are returned to, user's input is waited, continues to execute.
Output 17. is without output
Algorithm CheckPath (R, path) checks routing algorithm
Input: 1. entrance object R
2. specified path path
Prepare parameter:
3. true path array arr
4. existing object O, is set as R
Algorithm:
5. path path is divided into array arr0 according to ' ', if there are .. in path, it is individually classified as array One ' .. '
6. above-mentioned array arr0 is traversed from the beginning to the end, for an object item, if it is not ' .. ', set In true path array arr, if an object is ' .. ', the last one object of true path array arr is popped up (total length of arr subtracts 1).If the length for executing discovery arr before this operation has been 0, " path is not present " is printed, Algorithm is exited, null(sky object is returned).
By this traversal, arr is ready to as true path.
7. being traversed from the beginning to the end for arr, for an object item, if be not present in the sub-key of existing object O Item then prints " path is not present ", exits algorithm, returns to null;If it is present setting O [item] for O.Traversal knot Then algorithm terminates and exports beam.
Output:
8. null(sky object) or object O
Algorithm ViewSummary (O, k, h) breviary checks algorithm
Input:
1. specified object O
2. horizontal spreading width k
3. longitudinal expansion depth h
Prepare parameter:
4. breviary object S is set as { } empty object
5. specified object indexing OP is set as O
6. breviary object indexing SP is set as S
7. breviary object indexing current depth SH is set as 0
Algorithm:
8. its preceding k key (using Object.keys (OP)) is taken for specifying object indexing OP, if being less than k key in total, Then take all keys.For each of this k key, perform the following operations:
9. for k key.If the type of OP [k] is non-object type and non-empty, key-value pair k, OP are set on SP Key-value pair k, { } is otherwise arranged in [k] on SP.
10. key-value pair length, Object.keys (OP) .length are arranged on SP, i.e., the key length of OP is marked Onto SP.
11. if stopping executing subalgorithm current depth SH is greater than longitudinal expansion depth h.
12. value obtains OP [k] on OP otherwise, for k key on SP, value obtains SP [K] on SP, with OP [k] and SP [k] are respectively OP and SP, execute algorithm 8.
13. each small algorithm 8 can terminate in its 11 links or 12 links, most terminate so as to cause big algorithm 8 Beam.
Output:
14. object S
The present invention devises a kind of method that edit object is browsed in order line, and the method for edit object is browsed in the order line Solve the problems, such as that common print object can not be shown whole in order line;Graceful heuristic navigation scheme is provided, it can be with Any object in nodejs memory is explored.It provides and is explored according to order, printed comprehensively, breviary printing, automatically The browsing modes such as browsing;It solves the problems, such as that memory object can not be changed when running in order line.Any object can be changed Arbitrary fields.Certainly, it to be used on appropriate opportunity;For various detail programmings, safeguarded on server line, provide it is a kind of preferably Solution, help to improve development efficiency, O&M debugging efficiency and content operation efficiency.
Specific embodiment
Specific embodiment browses the method for edit object in a kind of order line, it is characterised in that the steps include:
(1), firstly, realizing a REPL environment, that is, Read-Eval-Print-Loop in command line environment, this REPL environment can receive different Ordered Registrations, whenever knocking in different orders, can carry out the execution letter of the corresponding command Number can wait the input of user, receive new order again after execution terminates;
(2), following order is registered in REPL environment and its executes function:
1, pwd order is meant that the object path listed and be currently located;
2, cd order, parameter are subpath subpath, are meant that into specified path, if subpath is sky, for current road Diameter, if subpath is ' .. ' jumps to one layer of path, if subpath is ' ... ', jump to the road that browsing starts Diameter exports ' specified path is not present ' if specified path is not present;
3, ls order, parameter are subpath subpath, are meant that the expansion for listing the existing object seen under specified path can Can property, including the case where object class object and general object, the two are indicated with different colours, only list specified path, not into Enter the path;
4, v order, parameter are subpath subpath, be meant that in specified path object execute view operation, without into Enter the path, the meaning of View is exactly to print full content in the way of the print screen that js defaults;
5, vs order, parameter are subpath subpath, horizontal spreading width k, and longitudinal expansion depth h is meant that for specified Object in path carries out view_summary operation, and the meaning without entering the path, View_summary is exactly to utilize me The breviary mode that provides check that the meaning of this breviary mode is the subobject exhibition for each level for object It opens, K subobject before only printing, and recurrence is in this way, maximum depth of recursion is that K is defaulted as 5, H and is defaulted as 4, because js defaults Print screen mode at most only can show 4 layers of content;
6, keys order, parameter are subpath subpath, are meant that all keys for the object for listing specified path, are equivalent to ls + subpath;
7, values order, parameter are subpath subpath, are meant that all values for listing the object of specified path;For every A value calls the print screen mode of js default to report that the object is not object if the object is not object type Type;
8, auto-command, parameter are subpath subpath, are meant that the object for specified path, carry out auto-browsing auto Operation;Auto operation is meant, carries out breadth first traversal for object;For the object of each traversal, view_ is carried out Summary operation;And list the place path of each existing object;To realize all interior of the browsing object of automation Hold;Because this navigation process may be unlimited or super length;So providing the mode of secession of ctrl+C;
9, replace order, parameter are subpath subpath, and the content obj replaced with is meant that pair for specified path As completely being replaced;Replace with the object of obj;Root object can completely be replaced;
10, update order, parameter are subpath subpath, and the content obj of update is meant that the object for specified path, It is updated operation;Original content will not be replaced completely by updating operation, only so that being determined as being worth accordingly on corresponding key obj;
11, remove order, parameter are subpath subpath, are meant that the object for specified path, carry out delete operation, The path no longer exists after deletion.
The present invention devises a kind of method that edit object is browsed in order line, and the side of edit object is browsed in the order line Method solves the problems, such as that common print object can not be shown whole in order line;Graceful heuristic navigation scheme is provided, it can To be explored for any object in nodejs memory.It provides and is explored according to order, printed comprehensively, breviary printing, from The browsing modes such as dynamic browsing;It solves the problems, such as that memory object can not be changed when running in order line.Any object can be changed Arbitrary fields.Certainly, it to be used on appropriate opportunity;For various detail programmings, safeguarded on server line, provide it is a kind of compared with Good solution, helps to improve development efficiency, O&M debugging efficiency and content operation efficiency.
Obviously, the above embodiments are merely examples for clarifying the description, and does not limit the embodiments.It is right For those of ordinary skill in the art, can also make on the basis of the above description it is other it is various forms of variation or It changes.There is no necessity and possibility to exhaust all the enbodiments.And it is extended from this it is obvious variation or It changes still within the protection scope of the invention.

Claims (1)

1. browsing the method for edit object in a kind of order line, it is characterised in that the steps include:
(1), firstly, realizing a REPL environment, that is, Read-Eval-Print-Loop in command line environment, this REPL environment can receive different Ordered Registrations, whenever knocking in different orders, can carry out the execution letter of the corresponding command Number can wait the input of user, receive new order again after execution terminates;
(2), following order is registered in REPL environment and its executes function:
<1>, pwd order is meant that the object path listed and be currently located;
<2>, cd order, parameter is subpath subpath, be meant that into specified path, if subpath be sky, to work as Preceding path, if subpath is ' .. ' jumps to one layer of path, if subpath is ' ... ', it jumps to browsing and starts Path export ' specified path is not present ' if specified path is not present;
<3>, ls order, parameter is subpath subpath, is meant that the exhibition for listing the existing object seen under specified path Possibility is opened, including the case where object class object and general object, the two are indicated with different colours, only list specified path, and The path is not entered;
<4>, v order, parameter is subpath subpath, be meant that in specified path object execute view operation, and The path is not entered, the meaning of View is exactly to print full content in the way of the print screen that js defaults;
<5>, vs order, parameter is subpath subpath, horizontal spreading width k, longitudinal that depth h is unfolded, and is meant that for referring to The object determined in path carries out view_summary operation, and the meaning without entering the path, View_summary is exactly to utilize The breviary mode that we provide checks object the meaning of this breviary mode is the subobject for each level Expansion, K subobject before only printing, and recurrence are in this way, maximum depth of recursion is that K is defaulted as 5, H and is defaulted as 4, because js is silent The print screen mode recognized at most can only show 4 layers of content;
<6>, keys order, parameter is subpath subpath, is meant that all keys for the object for listing specified path, is equivalent to Ls+subpath;
<7>, values order, parameter is subpath subpath, is meant that all values for listing the object of specified path;For Each value calls the print screen mode of js default to report that the object is not if the object is not object type Object type;
<8>, auto-command, parameter is subpath subpath, is meant that the object for specified path, carries out auto-browsing Auto operation;Auto operation is meant, carries out breadth first traversal for object;For the object of each traversal, carry out View_summary operation;And list the place path of each existing object;To realize the institute for browsing object of automation There is content;Because this navigation process may be unlimited or super length;So providing the mode of secession of ctrl+C;
<9>, replace order, parameter is subpath subpath, and the content obj replaced with is meant that for specified path Object is completely replaced;Replace with the object of obj;Root object can completely be replaced;
<10>, update order, parameter is subpath subpath, and the content obj of update is meant that pair for specified path As being updated operation;Original content will not be replaced completely by updating operation, only so that being determined as being worth accordingly on corresponding key obj;
<11>, remove order, parameter is subpath subpath, is meant that the object for specified path, carries out deletion behaviour Make, the path no longer exists after deletion.
CN201710829138.6A 2017-09-14 2017-09-14 The method of edit object is browsed in a kind of order line Pending CN109508184A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710829138.6A CN109508184A (en) 2017-09-14 2017-09-14 The method of edit object is browsed in a kind of order line

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710829138.6A CN109508184A (en) 2017-09-14 2017-09-14 The method of edit object is browsed in a kind of order line

Publications (1)

Publication Number Publication Date
CN109508184A true CN109508184A (en) 2019-03-22

Family

ID=65744611

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710829138.6A Pending CN109508184A (en) 2017-09-14 2017-09-14 The method of edit object is browsed in a kind of order line

Country Status (1)

Country Link
CN (1) CN109508184A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222012A (en) * 2010-04-14 2011-10-19 微软公司 Static type checking against external data sources
CN102508667A (en) * 2011-11-11 2012-06-20 迈普通信技术股份有限公司 Method and device for using third-part JavaScript library
CN105159664A (en) * 2015-08-07 2015-12-16 苏州博优赞信息科技有限责任公司 Mode for realizing key-value storage based on javascript
US20170228219A1 (en) * 2015-11-30 2017-08-10 International Business Machines Corporation Undo/redo in javascript object notation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222012A (en) * 2010-04-14 2011-10-19 微软公司 Static type checking against external data sources
CN102508667A (en) * 2011-11-11 2012-06-20 迈普通信技术股份有限公司 Method and device for using third-part JavaScript library
CN105159664A (en) * 2015-08-07 2015-12-16 苏州博优赞信息科技有限责任公司 Mode for realizing key-value storage based on javascript
US20170228219A1 (en) * 2015-11-30 2017-08-10 International Business Machines Corporation Undo/redo in javascript object notation

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
MINJUN0901: ""怎么样遍历js 对象属性,控制循环次数?"", 《HTTPS://BBS.CSDN.NET/TOPICS/350193459》 *
SWFBARHR: ""blog / node / console.md"", 《HTTPS://GITHUB.COM/SWFBARHR/BLOG/BLOB/MASTER/NODE/CONSOLE.MD》 *
TUMARS: ""撸js基础之对象"", 《HTTP://C.360WEBCACHE.COM/C?M=91A3C263D915A9CC44C6F942623E770A&Q=HTTP%3A%2F%2FWWW.FERECORD.COM%2FLUJS-OBJECT.HTML&U=HTTP%3A%2F%2FWWW.FERECORD.COM%2FLUJS-OBJECT.HTML》 *
张轶博等: "《Linux 应用大全》", 31 January 2000, 机械工业出版社 *
福州-司马懿: ""Node.js REPL模块"", 《HTTPS://BLOG.CSDN.NET/CHY555CHY/ARTICLE/DETAILS/52698810?》 *

Similar Documents

Publication Publication Date Title
CN102982172B (en) Webpage search browser and web search method
CN106033393B (en) A kind of applied program testing method and system and mobile terminal
CN103763433B (en) The progress control method of terminal applies and system
CN103761276B (en) Methods of exhibiting and device that a kind of tree structure data compares
CN102982173B (en) A kind of web search method and device
CN103425771B (en) The method for digging of a kind of data regular expression and device
JP2011070669A5 (en)
CN104077228B (en) A kind of EFSM based on predicate dependency graph can perform method for creating test sequence
JP2010218152A (en) Apparatus and method for generating test case
CN108647145A (en) software memory safety detection method and system
CN109240666B (en) Function calling code generation method and system based on call stack and dependent path
CN109344230A (en) Code library file generation, code search, connection, optimization and transplantation method
CN108304112A (en) Data processing method and device
Shamim et al. A framework for generation of rules from decision tree and decision table
CN107426041A (en) A kind of method and apparatus of resolve command
CN110673844A (en) Image processing software development method and system
CN103761240B (en) Data bank access method and device
CN101710305A (en) Method and system for realizing white box testing of computer software
CN109508184A (en) The method of edit object is browsed in a kind of order line
CN104731695B (en) A kind of unit test system and method for supporting the input of table driving bottom
CN112333101A (en) Network topology path finding method, device, equipment and storage medium
EP3635561B1 (en) Asynchronous operation query
CN106708566A (en) Method for judgment of installation of application programs and judgment system
CN106911730A (en) A kind of cloud disk service device accesses moving method and device
CN103632099B (en) The Native api function acquisition methods do not derived and device

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190322