Browse Source

更新 'README.md'

master
梁 致源 2 years ago
parent
commit
528cbaa735
1 changed files with 38 additions and 1 deletions
  1. +38
    -1
      README.md

+ 38
- 1
README.md View File

@@ -1,3 +1,40 @@
# grsync

111
```go
package main

import (
"fmt"
"grsync"
"time"
)

func main() {
task := grsync.NewTask(
"username@server.com:/source/folder",
"/home/user/destination",
grsync.RsyncOptions{},
)

go func() {
for {
state := task.State()
fmt.Printf(
"progress: %.2f / rem. %d / tot. %d / sp. %s \n",
state.Progress,
state.Remain,
state.Total,
state.Speed,
)
time.Sleep(time.Second)
}
}()

if err := task.Run(); err != nil {
panic(err)
}

fmt.Println("well done")
fmt.Println(task.Log())
}
```

Loading…
Cancel
Save