lots of changes and reducing dependency imports

This commit is contained in:
Robin Olsen
2026-02-28 16:39:50 +01:00
parent 697b17e890
commit ba0115d1bc
54 changed files with 458 additions and 327 deletions

View File

@@ -3,10 +3,14 @@ package surveyCmd
import (
"context"
"github.com/LazyBachelor/LazyPM/internal/service"
"github.com/LazyBachelor/LazyPM/internal/models"
"github.com/spf13/cobra"
)
type App = models.App
var app *App
const appKey string = "app"
const long string = `Project Management Interface Survey
@@ -18,8 +22,6 @@ This survey will present you with a series of tasks to complete using various in
Please answer the questions honestly and to the best of your ability.
Your responses will be kept confidential and used solely for research purposes.`
var app *service.App
// RootCmd is the base command for the survey CLI.
var RootCmd = &cobra.Command{
Use: "survey",
@@ -31,12 +33,12 @@ var RootCmd = &cobra.Command{
},
}
func SetApp(application *service.App) {
func SetApp(application *App) {
app = application
}
func AppFromContext(ctx context.Context) *service.App {
if a, ok := ctx.Value(appKey).(*service.App); ok {
func AppFromContext(ctx context.Context) *App {
if a, ok := ctx.Value(appKey).(*App); ok {
return a
}
return app

View File

@@ -1,7 +1,7 @@
package surveyCmd
import (
"github.com/LazyBachelor/LazyPM/internal/commands"
"github.com/LazyBachelor/LazyPM/internal/utils"
"github.com/LazyBachelor/LazyPM/pkg/task"
"github.com/spf13/cobra"
)
@@ -20,6 +20,6 @@ var StartCmd = &cobra.Command{
func init() {
StartCmd.Flags().StringVarP(&Task, "task", "t", "", "Specify task.")
StartCmd.Flags().StringVarP(&InterfaceType, "interface", "i", "", "Specify interface.")
StartCmd.RegisterFlagCompletionFunc("task", commands.CompletionFunc(task.ListTasks()))
StartCmd.RegisterFlagCompletionFunc("interface", commands.CompletionFunc(task.ListInterfaces()))
StartCmd.RegisterFlagCompletionFunc("task", utils.CompletionFunc(task.ListTasks()))
StartCmd.RegisterFlagCompletionFunc("interface", utils.CompletionFunc(task.ListInterfaces()))
}