forked from ForceCLI/force
-
Notifications
You must be signed in to change notification settings - Fork 0
/
limits.go
51 lines (38 loc) · 894 Bytes
/
limits.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"fmt"
"sort"
)
var cmdLimits = &Command{
Usage: "limits",
Short: "Display current limits",
Long: `
Use the limits command to display limits information for your organization.
-- Max is the limit total for the organization.
-- Remaining is the total number of calls or events left for the organization.`,
}
func init() {
cmdLimits.Run = runLimits
}
func runLimits(cmd *Command, args []string) {
force, _ := ActiveForce()
var result ForceLimits
result, err := force.GetLimits()
if err != nil {
ErrorAndExit(err.Error())
} else {
printLimits(result)
}
}
func printLimits(result map[string]ForceLimit) {
//sort keys
var keys []string
for k := range result {
keys = append(keys, k)
}
sort.Strings(keys)
//print map
for _, k := range keys {
fmt.Println(k, "\n ", result[k].Max, "maximum\n", result[k].Remaining, "remaining\n ")
}
}