Skip to content

Commit

Permalink
Error out when args are passed to commands that don't take args
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkpickering committed Nov 10, 2023
1 parent 33ebacd commit 8b956d1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/create_card.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions cmd/list_cards.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions cmd/list_decks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions cmd/study.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8b956d1

Please sign in to comment.