1
0
Fork 0
mirror of https://github.com/Luzifer/dbx-sync.git synced 2024-12-22 10:51:17 +00:00

Hide Dropbox API stuff when being verbose

This commit is contained in:
Knut Ahlers 2016-10-10 17:10:45 +02:00
parent 40c2a0445b
commit 06b3dad398
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -16,6 +16,7 @@ import (
var ( var (
cfg = struct { cfg = struct {
Debug bool `flag:"debug" default:"false" description:"Turn on debug output"`
DropboxToken string `flag:"dropbox-token" env:"DROPBOX_TOKEN" description:"Dropbox token to use to access API"` DropboxToken string `flag:"dropbox-token" env:"DROPBOX_TOKEN" description:"Dropbox token to use to access API"`
ForceOverwrite bool `flag:"force-overwrite" default:"false" description:"Upload files even when they exist on target"` ForceOverwrite bool `flag:"force-overwrite" default:"false" description:"Upload files even when they exist on target"`
Verbose bool `flag:"verbose,v" default:"false" description:"Enable verbose logging"` Verbose bool `flag:"verbose,v" default:"false" description:"Enable verbose logging"`
@ -34,6 +35,10 @@ func init() {
fmt.Printf("dbx-sync %s\n", version) fmt.Printf("dbx-sync %s\n", version)
os.Exit(0) os.Exit(0)
} }
if cfg.Debug {
cfg.Verbose = true
}
} }
func main() { func main() {
@ -52,7 +57,7 @@ func main() {
log.Fatalf("Destination prefix must start with '/': %q", destPrefix) log.Fatalf("Destination prefix must start with '/': %q", destPrefix)
} }
config := dropbox.Config{Token: cfg.DropboxToken, Verbose: cfg.Verbose} config := dropbox.Config{Token: cfg.DropboxToken, Verbose: cfg.Debug}
dbx := files.New(config) dbx := files.New(config)
remoteFilesPresent, err := getRemoteFileList(dbx, rconfig.Args()[2]) remoteFilesPresent, err := getRemoteFileList(dbx, rconfig.Args()[2])