mirror of
https://github.com/Xevion/HATray.git
synced 2025-12-05 23:15:09 -06:00
refactor: switch AppState to iota-based enum
This commit is contained in:
@@ -15,13 +15,25 @@ type App struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AppState represents the current state of the application
|
// AppState represents the current state of the application
|
||||||
type AppState string
|
type AppState int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
StateRunning AppState = "running"
|
StatePaused AppState = iota
|
||||||
StatePaused AppState = "paused"
|
StateRunning
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// String returns the string representation of the AppState
|
||||||
|
func (s AppState) String() string {
|
||||||
|
switch s {
|
||||||
|
case StatePaused:
|
||||||
|
return "paused"
|
||||||
|
case StateRunning:
|
||||||
|
return "running"
|
||||||
|
default:
|
||||||
|
return "unknown"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NewApp creates a new application instance
|
// NewApp creates a new application instance
|
||||||
func NewApp(logger *slog.Logger) *App {
|
func NewApp(logger *slog.Logger) *App {
|
||||||
return &App{
|
return &App{
|
||||||
|
|||||||
Reference in New Issue
Block a user