add sync command to synchronize yanked/deleted files with server

Mentioned in #13 and #36.
This commit is contained in:
Gokcehan 2016-11-09 00:39:39 +03:00
parent c9023d4cdc
commit 9962827926
4 changed files with 15 additions and 0 deletions

View File

@ -37,6 +37,7 @@ var (
"delete", "delete",
"put", "put",
"renew", "renew",
"sync",
"echo", "echo",
"cd", "cd",
"push", "push",

1
doc.go
View File

@ -38,6 +38,7 @@ The following commands are provided by lf with default keybindings.
The following commands are provided by lf without default keybindings. The following commands are provided by lf without default keybindings.
sync synchronizes yanked/deleted files with server
echo prints its arguments to the message line echo prints its arguments to the message line
cd changes working directory to its argument cd changes working directory to its argument
push simulate key pushes given in its argument push simulate key pushes given in its argument

View File

@ -42,6 +42,7 @@ The following commands are provided by lf with default keybindings.
The following commands are provided by lf without default keybindings. The following commands are provided by lf without default keybindings.
sync synchronizes yanked/deleted files with server
echo prints its arguments to the message line echo prints its arguments to the message line
cd changes working directory to its argument cd changes working directory to its argument
push simulate key pushes given in its argument push simulate key pushes given in its argument

12
eval.go
View File

@ -325,6 +325,18 @@ func (e *CallExpr) eval(app *App, args []string) {
app.ui.sync() app.ui.sync()
app.ui.renew() app.ui.renew()
app.nav.renew(app.ui.wins[0].h) app.nav.renew(app.ui.wins[0].h)
case "sync":
list, copy, err := loadFiles()
if err != nil {
msg := fmt.Sprintf("sync: %s", err)
app.ui.message = msg
log.Printf(msg)
return
}
app.nav.saves = make(map[string]bool)
for _, f := range list {
app.nav.saves[f] = copy
}
case "echo": case "echo":
app.ui.message = strings.Join(e.args, " ") app.ui.message = strings.Join(e.args, " ")
case "cd": case "cd":