From 294f2524f51046e9f08895fd1f36efae64e07268 Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Tue, 17 Feb 2026 16:39:59 +0100 Subject: [PATCH] add submit command(empty) change to use flag to specify interface type --- cmd/survey/cmd.go | 60 +++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/cmd/survey/cmd.go b/cmd/survey/cmd.go index fdbdaa7..65d86b0 100644 --- a/cmd/survey/cmd.go +++ b/cmd/survey/cmd.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "github.com/LazyBachelor/LazyPM/pkg/cli/repl" "github.com/LazyBachelor/LazyPM/pkg/task" "github.com/LazyBachelor/LazyPM/pkg/tui" @@ -8,19 +10,51 @@ import ( "github.com/spf13/cobra" ) +var interfaceType string + var rootCmd = &cobra.Command{ - Use: "survey", - Short: "This application exists to gather metrics and feedback on task management interfaces.", -} + Use: "survey", + Long: `Project Management Interface Survey + +Thank you for participating in our survey! + +We are gathering data on how users interact with different task management interfaces to better understand their preferences and compare their usability. +This survey will present you with a series of tasks to complete using various interfaces, including command-line, web-based, and terminal user interfaces. + +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 startCmd = &cobra.Command{ Use: "start", Short: "Start the user survey", RunE: runStartCmd, - Args: cobra.MinimumNArgs(0), +} + +var submitCmd = &cobra.Command{ + Use: "submit", + Short: "Submit your survey responses", + RunE: func(cmd *cobra.Command, args []string) error { + cmd.Println("Submitting responses and metrics...") + return nil + }, } func runStartCmd(cmd *cobra.Command, args []string) error { + interfaces := initInterfaces() + + if cmd.Flags().Changed("interface") { + switch interfaceType { + case "tui": + interfaces = []task.Interface{tui.NewTui()} + case "repl": + interfaces = []task.Interface{repl.NewRepl()} + case "web": + interfaces = []task.Interface{web.NewWeb()} + default: + return fmt.Errorf("invalid interface type: %s", interfaceType) + } + } + if err := newIntroModel().Run(); err != nil { return returnIfUserQuit(err, "failed to run intro") } @@ -33,22 +67,6 @@ func runStartCmd(cmd *cobra.Command, args []string) error { surveyTasks := initTasks(svc) - interfaces := []task.Interface{} - - if len(args) == 0 { - interfaces = initInterfaces() - } else { - if args[0] == "tui" { - interfaces = []task.Interface{tui.NewTui()} - } - if args[0] == "repl" { - interfaces = []task.Interface{repl.NewRepl()} - } - if args[0] == "web" { - interfaces = []task.Interface{web.NewWeb()} - } - } - if err := taskLoop(cmd.Context(), surveyTasks, interfaces); err != nil { return returnIfUserQuit(err, "task loop failed") } @@ -57,5 +75,7 @@ func runStartCmd(cmd *cobra.Command, args []string) error { func init() { rootCmd.CompletionOptions.DisableDefaultCmd = true + startCmd.Flags().StringVarP(&interfaceType, "interface", "i", "", "Specify which interface to use for the survey (tui, repl, web).") rootCmd.AddCommand(startCmd) + rootCmd.AddCommand(submitCmd) }