sentralize userquiterror
This commit is contained in:
@@ -1,17 +1,15 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/LazyBachelor/LazyPM/internal/style"
|
"github.com/LazyBachelor/LazyPM/internal/style"
|
||||||
|
"github.com/LazyBachelor/LazyPM/pkg/task"
|
||||||
"github.com/charmbracelet/bubbles/key"
|
"github.com/charmbracelet/bubbles/key"
|
||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
"github.com/charmbracelet/lipgloss"
|
"github.com/charmbracelet/lipgloss"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrUserQuit = errors.New("user quit")
|
|
||||||
|
|
||||||
const stages = 2
|
const stages = 2
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -77,7 +75,7 @@ func (m introModel) Run() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if m, ok := model.(introModel); ok && m.userQuit {
|
if m, ok := model.(introModel); ok && m.userQuit {
|
||||||
return ErrUserQuit
|
return task.ErrUserQuit
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import (
|
|||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrUserQuit = fmt.Errorf("user quit")
|
|
||||||
|
|
||||||
// RunTask orchestrates the complete task execution flow:
|
// RunTask orchestrates the complete task execution flow:
|
||||||
// 1. Setup the task
|
// 1. Setup the task
|
||||||
// 2. Show task intro screen
|
// 2. Show task intro screen
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package task
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/LazyBachelor/LazyPM/internal/service"
|
"github.com/LazyBachelor/LazyPM/internal/service"
|
||||||
taskui "github.com/LazyBachelor/LazyPM/pkg/task/ui"
|
taskui "github.com/LazyBachelor/LazyPM/pkg/task/ui"
|
||||||
@@ -9,6 +10,8 @@ import (
|
|||||||
|
|
||||||
type TaskConfig = service.Config
|
type TaskConfig = service.Config
|
||||||
|
|
||||||
|
var ErrUserQuit = fmt.Errorf("user quit")
|
||||||
|
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
Run(context.Context, TaskConfig) error
|
Run(context.Context, TaskConfig) error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package taskui
|
package taskui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -11,8 +10,6 @@ import (
|
|||||||
tea "github.com/charmbracelet/bubbletea"
|
tea "github.com/charmbracelet/bubbletea"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrUserQuit = errors.New("user quit")
|
|
||||||
|
|
||||||
type TaskDetails struct {
|
type TaskDetails struct {
|
||||||
Title string
|
Title string
|
||||||
Description string
|
Description string
|
||||||
|
|||||||
Reference in New Issue
Block a user