Пример #1
0
var remoteIdQuestion = &question{
	"remote_id",
	"Remote folder ID to sync with, L for list.",
	"root",
}

var authorizationCodeQuestion = &question{
	"auth_code",
	"OAuth 2.0 authorization code.",
	"",
}

var localPathQuestion = &question{
	"local_path",
	"Local path to sync from.",
	config.DefaultMountpoint(),
}

type question struct {
	Name    string
	Usage   string
	Default string
}

func readQuestion(opt *question) string {
	var s string
	for s == "" {
		fmt.Printf("%v %v [default=%v]>> ", opt.Usage, Bold(opt.Name), Blue(opt.Default))
		_, err := fmt.Scanln(&s)
		if err != nil && err.Error() != "unexpected newline" {
			logger.F("Bad scan.", err)
Пример #2
0
	"github.com/rakyll/drivefuse/auth"
	"github.com/rakyll/drivefuse/blob"
	"github.com/rakyll/drivefuse/cmd"
	"github.com/rakyll/drivefuse/config"
	"github.com/rakyll/drivefuse/logger"
	"github.com/rakyll/drivefuse/metadata"
	"github.com/rakyll/drivefuse/mount"
	"github.com/rakyll/drivefuse/syncer"

	client "github.com/rakyll/drivefuse/third_party/code.google.com/p/google-api-go-client/drive/v2"
)

var (
	flagDataDir    = flag.String("datadir", config.DefaultDataDir(), "path of the data directory")
	flagMountPoint = flag.String("mountpoint", config.DefaultMountpoint(), "mount point")
	flagBlockSync  = flag.Bool("blocksync", false, "set true to force blocking sync on startup")

	flagRunAuthWizard = flag.Bool("wizard", false, "Run the startup wizard.")

	metaService  *metadata.MetaService
	driveService *client.Service
	blobManager  *blob.Manager
)

func main() {
	flag.Parse()
	// add a lock to the config dir, no two instances should
	// run at the same time
	cfg := config.NewConfig(*flagDataDir)
	err := cfg.Setup()