Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ListAllBoards = &cobra.Command{ Use: "list", Short: "List all the boards", Long: `List all boards saved in the user config.`, Run: func(cmd *cobra.Command, args []string) { config, err := domain.GetUserConfig() if err != nil { log.Fatalf("Failed to get the user config. %s", err) } t := table.NewWriter() t.SetOutputMirror(os.Stdout) t.AppendHeader(table.Row{"#", "Board", "Number of tasks", "Progress", "Path"}) for i, board := range config.Boards { totalNumberOfTasks := 0 numberOfCompletedTasks := 0 for i, columnName := range board.Columns { totalNumberOfTasks += len(board.Tasks[columnName]) if i == len(board.Columns)-1 { numberOfCompletedTasks += len(board.Tasks[columnName]) } } progress := float32(0) if totalNumberOfTasks != 0 { progress = float32(numberOfCompletedTasks) / float32(totalNumberOfTasks) } t.AppendRow([]any{ i + 1, board.Name, totalNumberOfTasks, fmt.Sprint("%", int(progress*100)), board.Dir, }) } t.AppendSeparator() t.Render() }, }
View Source
var OpenConfig = &cobra.Command{ Use: "config", Short: "Opens the config file", Long: `Opens the config file for all projects in Vi.`, Run: func(cmd *cobra.Command, args []string) { path, err := domain.GetConfigFilePathBasedOnOS() if err != nil { log.Fatalln("Failed to open up the config. ", err) } editor := os.Getenv(vars.EditorOfChoice) if editor == "" { editor = "vi" } err = utils.OpenInEditor(editor, path) if err != nil { log.Fatalf("Failed to open the config file in %s. %s\n", editor, err) } }, }
View Source
var OpenLogs = &cobra.Command{ Use: "logs", Short: "Opens the logs file", Long: `Opens the logs file for all projects in Vi.`, Run: func(cmd *cobra.Command, args []string) { path, err := domain.GetLogsFilePathBasedOnOS() if err != nil { log.Fatalln("Failed to open up the log file. ", err) } editor := os.Getenv(vars.EditorOfChoice) if editor == "" { editor = "vi" } err = utils.OpenInEditor(editor, path) if err != nil { log.Fatalf("Failed to open the config file in %s. %s\n", editor, err) } }, }
Functions ¶
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.