use 'q' to quit tson

develop
skanehira 5 years ago
parent fef7e8a520
commit 763423109a

@ -47,13 +47,14 @@ $ tson -url http://gorilla/likes/json
| A | add new value | | A | add new value |
| d | clear children nodes | | d | clear children nodes |
| e | edit json with $EDITOR(only when use --url) | | e | edit json with $EDITOR(only when use --url) |
| q | quit tson |
| Enter | edit node | | Enter | edit node |
| / | search nodes | | / | search nodes |
| ? | show helps | | ? | show helps |
| space | expand/collaspe children nodes | | space | expand/collaspe children nodes |
| ctrl-j | move to next parent node | | ctrl-j | move to next parent node |
| ctrk-k | move to next previous node | | ctrk-k | move to next previous node |
| ctrl-c | exit tson | | ctrl-c | quit tson |
### help ### help
| key | description | | key | description |

@ -39,6 +39,7 @@ var (
addNewValue = fmt.Sprintf(RedColor, "A", " add new value") addNewValue = fmt.Sprintf(RedColor, "A", " add new value")
clearChildrenNodes = fmt.Sprintf(RedColor, "d", " clear children nodes") clearChildrenNodes = fmt.Sprintf(RedColor, "d", " clear children nodes")
editNodes = fmt.Sprintf(RedColor, "e", " edit json with $EDITOR(only when use --url)") editNodes = fmt.Sprintf(RedColor, "e", " edit json with $EDITOR(only when use --url)")
quitTson = fmt.Sprintf(RedColor, "q", " quit tson")
editNodeValue = fmt.Sprintf(RedColor, "Enter", "edit current node") editNodeValue = fmt.Sprintf(RedColor, "Enter", "edit current node")
searchNodes = fmt.Sprintf(RedColor, "/", " search nodes") searchNodes = fmt.Sprintf(RedColor, "/", " search nodes")
toggleExpandNodes = fmt.Sprintf(RedColor, "space", " expand/collaspe nodes") toggleExpandNodes = fmt.Sprintf(RedColor, "space", " expand/collaspe nodes")
@ -46,7 +47,7 @@ var (
movePreParentNode = fmt.Sprintf(RedColor, "ctrl-k", "move to previous parent node") movePreParentNode = fmt.Sprintf(RedColor, "ctrl-k", "move to previous parent node")
treeNavi = strings.Join([]string{hideNode, collaspeAllNode, expandNode, expandAllNode, treeNavi = strings.Join([]string{hideNode, collaspeAllNode, expandNode, expandAllNode,
readFile, saveFile, addNewNode, addNewValue, clearChildrenNodes, editNodeValue, searchNodes, readFile, saveFile, addNewNode, addNewValue, clearChildrenNodes, editNodeValue, searchNodes,
moveNextParentNode, movePreParentNode, editNodes}, "\n") moveNextParentNode, movePreParentNode, editNodes, quitTson}, "\n")
) )
type Navi struct { type Navi struct {

@ -163,6 +163,8 @@ func (t *Tree) SetKeybindings(g *Gui) {
case ' ': case ' ':
current := t.GetCurrentNode() current := t.GetCurrentNode()
current.SetExpanded(!current.IsExpanded()) current.SetExpanded(!current.IsExpanded())
case 'q':
g.App.Stop()
} }
switch event.Key() { switch event.Key() {

Loading…
Cancel
Save