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 |
| d | clear children nodes |
| e | edit json with $EDITOR(only when use --url) |
| q | quit tson |
| Enter | edit node |
| / | search nodes |
| ? | show helps |
| space | expand/collaspe children nodes |
| ctrl-j | move to next parent node |
| ctrk-k | move to next previous node |
| ctrl-c | exit tson |
| ctrl-c | quit tson |
### help
| key | description |

@ -39,6 +39,7 @@ var (
addNewValue = fmt.Sprintf(RedColor, "A", " add new value")
clearChildrenNodes = fmt.Sprintf(RedColor, "d", " clear children nodes")
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")
searchNodes = fmt.Sprintf(RedColor, "/", " search 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")
treeNavi = strings.Join([]string{hideNode, collaspeAllNode, expandNode, expandAllNode,
readFile, saveFile, addNewNode, addNewValue, clearChildrenNodes, editNodeValue, searchNodes,
moveNextParentNode, movePreParentNode, editNodes}, "\n")
moveNextParentNode, movePreParentNode, editNodes, quitTson}, "\n")
)
type Navi struct {

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

Loading…
Cancel
Save