-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
worked on the show and remove history functionalities and updated the…
… total-amount update and remove functionalities
- Loading branch information
1 parent
6a2a978
commit 8ebd738
Showing
9 changed files
with
145 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package spend_subhandler | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/ibilalkayy/flow/db/budget_db" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// RemoveCmd represents the remove command | ||
var RemoveCmd = &cobra.Command{ | ||
Use: "remove", | ||
Short: "Remove the history data", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
category, _ := cmd.Flags().GetString("category") | ||
err := budget_db.RemoveHistory(category) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
RemoveCmd.Flags().StringP("category", "c", "", "Write the category to remove it's history") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package spend_subhandler | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/ibilalkayy/flow/db/budget_db" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// ShowCmd represents the show command | ||
var ShowCmd = &cobra.Command{ | ||
Use: "show", | ||
Short: "Show the history data", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
category, _ := cmd.Flags().GetString("category") | ||
err := budget_db.ViewHistory(category) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
ShowCmd.Flags().StringP("category", "c", "", "Write the category to show it's history") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,25 @@ | ||
package total_amount_handler | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
|
||
"github.com/ibilalkayy/flow/db/total_amount_db" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func removeData() error { | ||
err := total_amount_db.RemoveTotalAmount("TotalAmount") | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = total_amount_db.RemoveTotalAmount("TotalAmountCategory") | ||
if err != nil { | ||
return err | ||
} | ||
return err | ||
} | ||
|
||
// RemoveCmd represents the remove command | ||
var RemoveCmd = &cobra.Command{ | ||
Use: "remove", | ||
Short: "Remove the total amount data", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
err := removeData() | ||
category, _ := cmd.Flags().GetString("category") | ||
err := total_amount_db.RemoveTotalAmount(category) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
fmt.Println("Total amount is successfully removed!") | ||
}, | ||
} | ||
|
||
func init() { | ||
RemoveCmd.Flags().StringP("category", "c", "", "Write the category to remove it's date") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters