Documentation
¶
Index ¶
Constants ¶
View Source
const SleepTime = time.Second / 4
SleepTime is the time for main fixed loop
Variables ¶
View Source
var Command = &cobra.Command{ Use: "waybar-lyric", Short: "A waybar module for song lyrics", SilenceUsage: true, RunE: Execute, PersistentPostRunE: func(_ *cobra.Command, _ []string) error { if logFile != nil { return logFile.Close() } return nil }, PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { if config.ToggleState { defer func() { cmd.RemoveCommand(playpause.Command) playpause.Command.Execute() os.Exit(0) }() } if config.PrintInit { defer func() { cmd.RemoveCommand(initcmd.Command) initcmd.Command.Execute() os.Exit(0) }() } switch config.FilterProfanityType { case "": config.FilterProfanity = false case "full", "partial": config.FilterProfanity = true default: return errors.New( "Profanity filter must one of 'full' or 'partial'", ) } if config.TooltipLines < 4 { return errors.New("Tooltip lines limit must be at least 4") } var level log.Level if config.Quiet { level = math.MaxInt } if config.Verbose { level = log.DebugLevel } handler := slog.New(log.NewWithOptions(os.Stderr, log.Options{ Level: log.Level(level), })) if config.LogFilePath == "" { slog.SetDefault(handler) return nil } os.MkdirAll(filepath.Dir(config.LogFilePath), 0o755) file, err := os.OpenFile( config.LogFilePath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o666, ) if err != nil { slog.SetDefault(handler) slog.Error("Failed to open log-file", "error", err) return err } slog.SetDefault(slog.New(slog.NewJSONHandler(file, &slog.HandlerOptions{ Level: slog.LevelDebug, AddSource: true, }))) logFile = file return nil }, }
Command is root command for waybar
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.