diff --git a/cmd/players.go b/cmd/players.go index 8bdcf82..aa3d14d 100644 --- a/cmd/players.go +++ b/cmd/players.go @@ -19,6 +19,7 @@ var ( flagClubID int flagNationID int flagLeagueID int + flagPosition []string flagPrice string flagWeakFoot string flagSkills string @@ -81,6 +82,7 @@ var playersCmd = &cobra.Command{ ClubID: flagClubID, NationID: flagNationID, LeagueID: flagLeagueID, + Position: flagPosition, Price: flagToRange(flagPrice), WeakFoot: flagToRange(flagWeakFoot), Skills: flagToRange(flagSkills), @@ -136,6 +138,7 @@ func init() { playersCmd.PersistentFlags().StringVar(&flagSkills, "skills", "", "Skills") playersCmd.PersistentFlags().StringVar(&flagRating, "ovr", "", "Rating") playersCmd.PersistentFlags().StringVar(&flagPrice, "price", "", "Price") + playersCmd.PersistentFlags().StringSliceVar(&flagPosition, "position", []string{}, "Position") playersCmd.PersistentFlags().StringVar(&flagPace, "pace", "", "Pace") playersCmd.PersistentFlags().StringVar(&flagAcceleration, "acceleration", "", "Acceleration") playersCmd.PersistentFlags().StringVar(&flagSprintSpeed, "sprint-speed", "", "Sprint Speed") diff --git a/go.mod b/go.mod index 120ebc2..4200edf 100644 --- a/go.mod +++ b/go.mod @@ -10,3 +10,24 @@ require ( github.com/spf13/cobra v1.2.1 github.com/spf13/viper v1.9.0 ) + +require ( + github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/magiconair/properties v1.8.5 // indirect + github.com/mattn/go-colorable v0.1.9 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mitchellh/mapstructure v1.4.2 // indirect + github.com/pelletier/go-toml v1.9.4 // indirect + github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/jwalterweatherman v1.1.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect + github.com/subosito/gotenv v1.2.0 // indirect + golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect + golang.org/x/text v0.3.6 // indirect + gopkg.in/ini.v1 v1.63.2 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect +) diff --git a/players/options.go b/players/options.go index 261749d..4384b66 100644 --- a/players/options.go +++ b/players/options.go @@ -9,7 +9,7 @@ type Options struct { Version string - Position []Position + Position []string NationID int LeagueID int ClubID int diff --git a/players/position.go b/players/position.go index 563e989..38297f5 100644 --- a/players/position.go +++ b/players/position.go @@ -1,23 +1,21 @@ package players const ( - GK Position = "GK" - RB Position = "RB" - RWB Position = "RWB" - LB Position = "LB" - LWB Position = "LWB" - CB Position = "CB" - CDM Position = "CDM" - CM Position = "CM" - CAM Position = "CAM" - RM Position = "RM" - RW Position = "RW" - RF Position = "RF" - LM Position = "LM" - LW Position = "LW" - LF Position = "LF" - CF Position = "CF" - ST Position = "ST" + PositionGK = "GK" + PositionRB = "RB" + PositionRWB = "RWB" + PositionLB = "LB" + PositionLWB = "LWB" + PositionCB = "CB" + PositionCDM = "CDM" + PositionCM = "CM" + PositionCAM = "CAM" + PositionRM = "RM" + PositionRW = "RW" + PositionRF = "RF" + PositionLM = "LM" + PositionLW = "LW" + PositionLF = "LF" + PositionCF = "CF" + PositionST = "ST" ) - -type Position string diff --git a/players/query.go b/players/query.go index 838e34c..6ba3640 100644 --- a/players/query.go +++ b/players/query.go @@ -11,23 +11,23 @@ type playerQuery struct { Version string `url:"version,omitempty"` - Position []Position `url:"position,omitempty"` - NationID int `url:"nation,omitempty"` - LeagueID int `url:"league,omitempty"` - ClubID int `url:"club,omitempty"` - WeakFoot int `url:"wf,omitempty"` - MinWeakFoot int `url:"min_wf,omitempty"` - MaxWeakFoot int `url:"max_wf,omitempty"` - Skills int `url:"skills,omitempty"` - MinSkills int `url:"min_skills,omitempty"` - MaxSkills int `url:"max_skills,omitempty"` - Foot Foot `url:"foot,omitempty"` - PsPrice string `url:"ps4price,omitempty"` - XboxPrice string `url:"xb1price,omitempty"` - PcPrice string `url:"pcprice,omitempty"` - Rating string `url:"rating,omitempty"` - Height string `url:"height,omitempty"` - Weight string `url:"weight,omitempty"` + Position []string `url:"position,comma,omitempty"` + NationID int `url:"nation,omitempty"` + LeagueID int `url:"league,omitempty"` + ClubID int `url:"club,omitempty"` + WeakFoot int `url:"wf,omitempty"` + MinWeakFoot int `url:"min_wf,omitempty"` + MaxWeakFoot int `url:"max_wf,omitempty"` + Skills int `url:"skills,omitempty"` + MinSkills int `url:"min_skills,omitempty"` + MaxSkills int `url:"max_skills,omitempty"` + Foot Foot `url:"foot,omitempty"` + PsPrice string `url:"ps4price,omitempty"` + XboxPrice string `url:"xb1price,omitempty"` + PcPrice string `url:"pcprice,omitempty"` + Rating string `url:"rating,omitempty"` + Height string `url:"height,omitempty"` + Weight string `url:"weight,omitempty"` Pace string `url:"Pace,omitempty"` Acceleration string `url:"Acceleration,omitempty"`