From f80df3a025de19729fc5e4faeac63be21f76d36b Mon Sep 17 00:00:00 2001 From: Adam Pickering Date: Fri, 10 Nov 2023 16:07:38 -0700 Subject: [PATCH] Error out when args are passed to commands that don't take args --- cmd/create_card.go | 1 + cmd/list_cards.go | 1 + cmd/list_decks.go | 1 + cmd/study.go | 1 + 4 files changed, 4 insertions(+) diff --git a/cmd/create_card.go b/cmd/create_card.go index 1173be6..343abb6 100644 --- a/cmd/create_card.go +++ b/cmd/create_card.go @@ -42,6 +42,7 @@ func init() { var createCardCmd = &cobra.Command{ Use: "card", Short: "Create card", + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { deckName := createCardFlags.DeckName deckSource, err := deck_source.NewJSONFileDeckSource(deckDirectory) diff --git a/cmd/list_cards.go b/cmd/list_cards.go index 840ec22..693dcb5 100644 --- a/cmd/list_cards.go +++ b/cmd/list_cards.go @@ -58,6 +58,7 @@ func init() { var listCardCmd = &cobra.Command{ Use: "cards", Short: "List cards", + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { deckName := listCardFlags.DeckNames deckSource, err := deck_source.NewJSONFileDeckSource(deckDirectory) diff --git a/cmd/list_decks.go b/cmd/list_decks.go index d96acf1..ae06786 100644 --- a/cmd/list_decks.go +++ b/cmd/list_decks.go @@ -46,6 +46,7 @@ func init() { var listDeckCmd = &cobra.Command{ Use: "decks", Short: "List decks", + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { deckSource, err := deck_source.NewJSONFileDeckSource(deckDirectory) if err != nil { diff --git a/cmd/study.go b/cmd/study.go index b5dd26e..48b8675 100644 --- a/cmd/study.go +++ b/cmd/study.go @@ -48,6 +48,7 @@ func init() { var studyCmd = &cobra.Command{ Use: "study", Short: "Study cards that are due", + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { deckName := studyFlags.DeckName deckSource, err := deck_source.NewJSONFileDeckSource(deckDirectory)