Skip to content

Commit

Permalink
preclimatization support added to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
theriverman committed Nov 13, 2022
1 parent 4bc1838 commit aaf4847
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ resource*.syso
# vendor/
.env
/voc/.env
oryxBuildBinary
16 changes: 16 additions & 0 deletions voc/cli.actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,22 @@ func actionStopEngine(c *cli.Context) error {
return client.Vehicles.EvaluateServiceStatusAuto(status)
}

func actionStartPreclimatization(c *cli.Context) error {
status, err := client.Vehicles.StartPreclimatization(selectedVin)
if err != nil {
return err
}
return client.Vehicles.EvaluateServiceStatusAuto(status)
}

func actionStopPreclimatization(c *cli.Context) error {
status, err := client.Vehicles.StopPreclimatization(selectedVin)
if err != nil {
return err
}
return client.Vehicles.EvaluateServiceStatusAuto(status)
}

func actionBlink(c *cli.Context) error {
status, err := client.Vehicles.BlinkLights(selectedVin, nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion voc/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/theriverman/VolvoOnCall/voc
go 1.19

require (
github.com/theriverman/VolvoOnCall v0.0.0-20220925184912-3a68114c366b
github.com/theriverman/VolvoOnCall v0.0.0-20221106210220-4bc1838e4b9b
github.com/tidwall/gjson v1.14.3
github.com/urfave/cli/v2 v2.16.3
golang.org/x/text v0.3.7
Expand Down
6 changes: 2 additions & 4 deletions voc/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/theriverman/VolvoOnCall v0.0.0-20220925184912-3a68114c366b h1:dD6vFmUb1JA+K7RFxn08J20ruoN/6Nftbs9vSiO861k=
github.com/theriverman/VolvoOnCall v0.0.0-20220925184912-3a68114c366b/go.mod h1:KBbdCLxAKpuPx4lauM2z/RimHRuWP0+adsNJxO9bC3Y=
github.com/theriverman/VolvoOnCall v0.0.0-20221106210220-4bc1838e4b9b h1:gXTUouMCrigB7tSQc3nn6ob8fWU/k8KZ3emqjEW9ZNs=
github.com/theriverman/VolvoOnCall v0.0.0-20221106210220-4bc1838e4b9b/go.mod h1:KBbdCLxAKpuPx4lauM2z/RimHRuWP0+adsNJxO9bC3Y=
github.com/tidwall/gjson v1.14.3 h1:9jvXn7olKEHU1S9vwoMGliaT8jq1vJ7IH/n9zD9Dnlw=
github.com/tidwall/gjson v1.14.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/urfave/cli/v2 v2.16.0 h1:p0XJ2TBh4AyH7twPdMBPL5OMrd9nxkAOOlTHxT5SNBA=
github.com/urfave/cli/v2 v2.16.0/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI=
github.com/urfave/cli/v2 v2.16.3 h1:gHoFIwpPjoyIMbJp/VFd+/vuD0dAgFK4B6DpEMFJfQk=
github.com/urfave/cli/v2 v2.16.3/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
Expand Down
20 changes: 20 additions & 0 deletions voc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,26 @@ func NewApplication() *cli.App {
},
},

// preclimatization
{
Name: "preclimatization",
Usage: "Start/Stop preclimatization",
Flags: commonFlagsVin(),
Before: selectVinOrThrowError,
Subcommands: []*cli.Command{
{
Name: "start",
Usage: "Start preclimatization",
Action: actionStartPreclimatization,
},
{
Name: "stop",
Usage: "Stop preclimatization",
Action: actionStopPreclimatization,
},
},
},

// honk and blink
{
Name: "blink",
Expand Down

0 comments on commit aaf4847

Please sign in to comment.