本文整理匯總了Golang中github.com/google/cups-connector/lib.Config.ToFile方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.ToFile方法的具體用法?Golang Config.ToFile怎麽用?Golang Config.ToFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/cups-connector/lib.Config
的用法示例。
在下文中一共展示了Config.ToFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: createConfigFile
func createConfigFile(xmppJID, robotRefreshToken, userRefreshToken, shareScope, proxy string) {
config := lib.Config{
xmppJID,
robotRefreshToken,
userRefreshToken,
shareScope,
proxy,
flagToUint(gcpMaxConcurrentDownloadsFlag, lib.DefaultConfig.GCPMaxConcurrentDownloads),
flagToUint(cupsMaxConnectionsFlag, lib.DefaultConfig.CUPSMaxConnections),
flagToDurationString(cupsConnectTimeoutFlag, lib.DefaultConfig.CUPSConnectTimeout),
flagToUint(cupsJobQueueSizeFlag, lib.DefaultConfig.CUPSJobQueueSize),
flagToDurationString(cupsPrinterPollIntervalFlag, lib.DefaultConfig.CUPSPrinterPollInterval),
lib.DefaultConfig.CUPSPrinterAttributes,
flagToBool(cupsJobFullUsernameFlag, lib.DefaultConfig.CUPSJobFullUsername),
flagToBool(cupsIgnoreRawPrintersFlag, lib.DefaultConfig.CUPSIgnoreRawPrinters),
flagToBool(copyPrinterInfoToDisplayNameFlag, lib.DefaultConfig.CopyPrinterInfoToDisplayName),
flagToString(monitorSocketFilenameFlag, lib.DefaultConfig.MonitorSocketFilename),
flagToString(gcpBaseURLFlag, lib.DefaultConfig.GCPBaseURL),
flagToString(gcpXMPPServerFlag, lib.DefaultConfig.XMPPServer),
flagToUint16(gcpXMPPPortFlag, lib.DefaultConfig.XMPPPort),
flagToDurationString(gcpXMPPPingTimeoutFlag, lib.DefaultConfig.XMPPPingTimeout),
flagToDurationString(gcpXMPPPingIntervalDefaultFlag, lib.DefaultConfig.XMPPPingIntervalDefault),
flagToString(gcpOAuthClientIDFlag, lib.DefaultConfig.GCPOAuthClientID),
flagToString(gcpOAuthClientSecretFlag, lib.DefaultConfig.GCPOAuthClientSecret),
flagToString(gcpOAuthAuthURLFlag, lib.DefaultConfig.GCPOAuthAuthURL),
flagToString(gcpOAuthTokenURLFlag, lib.DefaultConfig.GCPOAuthTokenURL),
flagToBool(snmpEnableFlag, lib.DefaultConfig.SNMPEnable),
flagToString(snmpCommunityFlag, lib.DefaultConfig.SNMPCommunity),
flagToUint(snmpMaxConnectionsFlag, lib.DefaultConfig.SNMPMaxConnections),
}
if err := config.ToFile(); err != nil {
log.Fatal(err)
}
}
示例2: writeConfigFile
func writeConfigFile(context *cli.Context, config *lib.Config) string {
if configFilename, err := config.ToFile(context); err != nil {
log.Fatalln(err)
} else {
return configFilename
}
panic("unreachable")
}