Leavitt/cmd/list.go

51 lines
1.5 KiB
Go

/*
Copyright © 2022 Sameer Rahmani <lxsameer@gnu.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cmd
import (
"github.com/spf13/cobra"
"serene-lang.org/leavitt/pkg/core"
)
// listCmd represents the list command
var listCmd = &cobra.Command{
Use: "list",
Short: "Lists all the TODOs and annotations in the project",
Long: `Lists all the TODOs and annotations in the project`,
Run: func(cmd *cobra.Command, args []string) {
ch := make(chan string, 10)
state.WaitGroup.Add(2)
go core.FindAllFiles(state, ch)
go core.ProcessFiles(state, ch)
go state.LogErrors()
state.WaitGroup.Wait()
close(state.ErrChannel)
},
}
func init() {
rootCmd.AddCommand(listCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// listCmd.PersistentFlags().String("path", ".", "Where to find the project")
}