Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

Commit 90bd366

Browse files
author
Lauri Piispanen
committed
add exluded locations to presets (fixes #83) (fixes #100)
1 parent eb88098 commit 90bd366

File tree

3 files changed

+397
-135
lines changed

3 files changed

+397
-135
lines changed

main.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@ func (i *arrayFlags) Set(value string) error {
2222
}
2323

2424
var locations arrayFlags
25+
var excludeLocations arrayFlags
2526

2627
func main() {
2728
token := flag.String("token", "", "Github auth token")
2829
amount := flag.Int("amount", 256, "Amount of users to show")
2930
considerNum := flag.Int("consider", 1000, "Amount of users to consider")
3031
outputOpt := flag.String("output", "plain", "Output format: plain, csv")
3132
fileName := flag.String("file", "", "Output file (optional, defaults to stdout)")
32-
preset := flag.String("preset", "", "Preset (optional)")
33+
presetName := flag.String("preset", "", "Preset (optional)")
3334

3435
flag.Var(&locations, "location", "Location to query")
3536
flag.Parse()
3637

37-
if *preset != "" {
38-
locations = Preset(*preset)
38+
if *presetName != "" {
39+
preset := Preset(*presetName)
40+
locations = preset.include
41+
excludeLocations = preset.exclude
3942
}
4043

4144
var format output.Format
@@ -50,7 +53,7 @@ func main() {
5053
log.Fatal("Unrecognized output format: ", *outputOpt)
5154
}
5255

53-
opts := top.Options{Token: *token, Locations: locations, Amount: *amount, ConsiderNum: *considerNum}
56+
opts := top.Options{Token: *token, Locations: locations, ExcludeLocations: excludeLocations, Amount: *amount, ConsiderNum: *considerNum}
5457
data, err := top.GithubTop(opts)
5558

5659
if err != nil {

0 commit comments

Comments
 (0)