本文整理汇总了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")
}