Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AlertCmd = &cobra.Command{ Use: "alert", Short: "Get notification once you pass the budget", Run: func(cmd *cobra.Command, args []string) { fmt.Println("Nothing specified, nothing added") }, }
AlertCmd represents the alert command
View Source
var CreateCmd = &cobra.Command{ Use: "create", Short: "Create the budget of different categories", Run: func(cmd *cobra.Command, args []string) { category, _ := cmd.Flags().GetString("category") amount, _ := cmd.Flags().GetString("amount") h := TakeHandler() amountInt := h.Deps.Common.StringToInt(amount) bv := entities.BudgetVariables{Category: category, Amount: amountInt} err := h.Deps.ManageBudget.CreateBudget(&bv) if err != nil { log.Fatal(err) } }, }
createCmd represents the create command
View Source
var GetCmd = &cobra.Command{ Use: "get", Short: "Get the budget data in CSV", Run: func(cmd *cobra.Command, args []string) { filepath, _ := cmd.Flags().GetString("filepath") filename, _ := cmd.Flags().GetString("filename") h := TakeHandler() err := h.Deps.ManageBudget.GetBudgetData(filepath, filename) if err != nil { log.Fatal(err) } }, }
GetCmd represents the get command
View Source
var RemoveCmd = &cobra.Command{ Use: "remove", Short: "Remove the budget details", Run: func(cmd *cobra.Command, args []string) { category, _ := cmd.Flags().GetString("category") h := TakeHandler() err := h.Deps.ManageBudget.RemoveBudget(category) if err != nil { log.Fatal(err) } }, }
RemoveCmd represents the remove command
View Source
var UpdateCmd = &cobra.Command{ Use: "update", Short: "Update the budget details", Run: func(cmd *cobra.Command, args []string) { oldCategory, _ := cmd.Flags().GetString("old-category") newCategory, _ := cmd.Flags().GetString("new-category") amount, _ := cmd.Flags().GetString("amount") h := TakeHandler() newAmount := h.Deps.Common.StringToInt(amount) bv := entities.BudgetVariables{ Category: oldCategory, Amount: newAmount, } err := h.Deps.ManageBudget.UpdateBudget(&bv, newCategory) if err != nil { log.Fatal(err) } fmt.Println("Your budget category is successfully updated!") }, }
UpdateCmd represents the update command
View Source
var ViewCmd = &cobra.Command{ Use: "view", Short: "View the budget details", Run: func(cmd *cobra.Command, args []string) { category, _ := cmd.Flags().GetString("category") h := TakeHandler() details, err := h.Deps.ManageBudget.ViewBudget(category) if err != nil { log.Fatal(err) } fmt.Println(details[0]) }, }
ViewCmd represents the view command
Functions ¶
func TakeHandler ¶ added in v0.1.110
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.