當前位置: 首頁>>代碼示例>>Golang>>正文


Golang cli.Arguments類代碼示例

本文整理匯總了Golang中github.com/prasmussen/gdrive/cli.Arguments的典型用法代碼示例。如果您正苦於以下問題:Golang Arguments類的具體用法?Golang Arguments怎麽用?Golang Arguments使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Arguments類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: getConfigDir

func getConfigDir(args cli.Arguments) string {
	// Use dir from environment var if present
	if os.Getenv("GDRIVE_CONFIG_DIR") != "" {
		return os.Getenv("GDRIVE_CONFIG_DIR")
	}
	return args.String("configDir")
}
開發者ID:RandomArray,項目名稱:gdrive,代碼行數:7,代碼來源:handlers_drive.go

示例2: checkUploadArgs

func checkUploadArgs(args cli.Arguments) {
	if args.Bool("recursive") && args.Bool("delete") {
		ExitF("--delete is not allowed for recursive uploads")
	}

	if args.Bool("recursive") && args.Bool("share") {
		ExitF("--share is not allowed for recursive uploads")
	}
}
開發者ID:RandomArray,項目名稱:gdrive,代碼行數:9,代碼來源:handlers_drive.go

示例3: conflictResolution

func conflictResolution(args cli.Arguments) drive.ConflictResolution {
	keepLocal := args.Bool("keepLocal")
	keepRemote := args.Bool("keepRemote")
	keepLargest := args.Bool("keepLargest")

	if (keepLocal && keepRemote) || (keepLocal && keepLargest) || (keepRemote && keepLargest) {
		ExitF("Only one conflict resolution flag can be given")
	}

	if keepLocal {
		return drive.KeepLocal
	}

	if keepRemote {
		return drive.KeepRemote
	}

	if keepLargest {
		return drive.KeepLargest
	}

	return drive.NoResolution
}
開發者ID:RandomArray,項目名稱:gdrive,代碼行數:23,代碼來源:handlers_drive.go

示例4: checkDownloadArgs

func checkDownloadArgs(args cli.Arguments) {
	if args.Bool("recursive") && args.Bool("delete") {
		ExitF("--delete is not allowed for recursive downloads")
	}
}
開發者ID:RandomArray,項目名稱:gdrive,代碼行數:5,代碼來源:handlers_drive.go

示例5: getOauthClient

func getOauthClient(args cli.Arguments) (*http.Client, error) {
	if args.String("refreshToken") != "" && args.String("accessToken") != "" {
		ExitF("Access token not needed when refresh token is provided")
	}

	if args.String("refreshToken") != "" {
		return auth.NewRefreshTokenClient(ClientId, ClientSecret, args.String("refreshToken")), nil
	}

	if args.String("accessToken") != "" {
		return auth.NewAccessTokenClient(ClientId, ClientSecret, args.String("accessToken")), nil
	}

	configDir := getConfigDir(args)
	tokenPath := ConfigFilePath(configDir, TokenFilename)
	return auth.NewFileSourceClient(ClientId, ClientSecret, tokenPath, authCodePrompt)
}
開發者ID:RandomArray,項目名稱:gdrive,代碼行數:17,代碼來源:handlers_drive.go


注:本文中的github.com/prasmussen/gdrive/cli.Arguments類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。