summaryrefslogtreecommitdiff
path: root/interact.go
diff options
context:
space:
mode:
Diffstat (limited to 'interact.go')
-rw-r--r--interact.go42
1 files changed, 37 insertions, 5 deletions
diff --git a/interact.go b/interact.go
index 906d221..67e7f15 100644
--- a/interact.go
+++ b/interact.go
@@ -283,8 +283,13 @@ func interact() {
c.Println(boldRed(arg,"is not a valid id!"))
}
}else{
- c.Println(boldRed("editcustomer <id> - Please enter an id"))
- allCustomers()
+ selids,lids := getCustomerList()
+ choice := c.MultiChoice(lids,"Select a Customer to Edit")
+ if choice > -1 {
+ editCustomer(selids[choice])
+ }
+ //c.Println(boldRed("editcustomer <id> - Please enter an id"))
+ //allCustomers()
}
c.Println(promptcol("______________________"))
},
@@ -355,6 +360,17 @@ func interact() {
})
shell.AddCmd(&ishell.Cmd{
+ Name: "allcustomers",
+ Help: "Show all Customers",
+ LongHelp: ` Usage: allcustomers
+ Show all Customers.`,
+ Func: func(c *ishell.Context) {
+ allCustomers()
+ c.Println(promptcol("______________________"))
+ },
+ })
+
+ shell.AddCmd(&ishell.Cmd{
Name: "showbills",
Help: "<n> - Show the last n bills",
LongHelp: ` Usage: showbills <n>
@@ -659,9 +675,7 @@ func isInterSure(question string) (bool) {
}
func getInterInput(question string) (out string) {
- shell := ishell.New()
- //shell.SetMultiChoicePrompt(" ->"," - ")
- //shell.SetChecklistOptions("[ ] ","[X] ")
+ shell := ishell.New()
shell.ShowPrompt(false)
defer shell.ShowPrompt(true)
@@ -671,6 +685,24 @@ func getInterInput(question string) (out string) {
return
}
+func getNewInterInput(question,old string) (string) {
+ shell := ishell.New()
+ shell.ShowPrompt(false)
+ defer shell.ShowPrompt(true)
+
+ if old != "" {
+ shell.Println("Current:",old)
+ }
+ shell.Print(question)
+ line := shell.ReadLine()
+
+ if line == "" {
+ return old
+ }else{
+ return line
+ }
+}
+
func multichoice(about string) {
shell := ishell.New()