Documentation
¶
Index ¶
- Variables
- func Execute()
- func GetBroadcast(name string) (chan string, bool)
- func InitFlags()
- func LoadConfigFile()
- func ReScanPath(path string, reScanFile bool)
- func ReScanUploadPath()
- func RegisterBroadcast(name string) chan string
- func ScanStore(args []string)
- func SetDaemon()
- func SetShutdownHandler()
- func SetStorePath(args []string)
- func ShowQRCode()
Constants ¶
This section is empty.
Variables ¶
var Args []string
var DemonFlag bool
DemonFlag TODO: 实测macos可用,正确地实装,需要理解守护进程的概念 需要去 cmd/init_flags.go 设置flag
var RootCmd = &cobra.Command{ Use: locale.GetString("comigo_use"), Short: locale.GetString("short_description"), Example: locale.GetString("comigo_example"), Version: config.GetVersion(), Long: locale.GetString("long_description"), Run: func(cmd *cobra.Command, args []string) { Args = args config.SetByExecutableFilename() config.AutoSetCachePath() }, }
RootCmd 没有任何子命令的情况下时的基本命令
var StopDaemonFlag bool
var ( // SystemBroadcast 等于 RegisterBroadcast("system") 返回的通道。 SystemBroadcast chan string )
broadcastRegistry 保存所有注册的系统广播通道,key 为自定义名称。 通过 map 的方式可以在不同包中动态注册并复用所需的广播通道。
Functions ¶
func GetBroadcast ¶ added in v1.0.0
GetBroadcast 返回指定名称的广播通道(只读锁)。
func LoadConfigFile ¶ added in v1.0.0
func LoadConfigFile()
LoadConfigFile 读取顺序:RAM(代码当中设定的默认值)+命令行参数 -> HomeDirectory -> ProgramDirectory -> WorkingDirectory
func ReScanPath ¶
func RegisterBroadcast ¶ added in v1.0.0
RegisterBroadcast 创建或返回一个已存在的广播通道。 不同模块可以调用此方法注册/获取自己的通道,实现解耦。
func SetDaemon ¶ added in v1.0.0
func SetDaemon()
SetDaemon 设置守护进程, To terminate the daemon use: kill `cat comigo.pid` 该函数会在Unix系统上将当前进程转化为守护进程,并在后台运行。 如果当前系统不是Unix系统,或者没有指定启动或停止守护进程的参数,则直接返回。 https://github.com/sevlyar/go-daemon https://github.com/sevlyar/go-daemon/blob/v0.1.6/examples/cmd/gd-simple/simple.go go run main.go --start go run main.go --stop
func SetStorePath ¶ added in v1.0.0
func SetStorePath(args []string)
SetStorePath 添加默认扫描路径 args[1:]是用户指定的扫描路径
func ShowQRCode ¶ added in v1.0.0
func ShowQRCode()
Types ¶
This section is empty.