summaryrefslogtreecommitdiff
path: root/src/rhctl/conf.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-04-21 00:21:05 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-04-21 00:21:05 (GMT)
commitfb6188fb495e8c2acd0a069566938436740784d0 (patch)
tree0e60e37830e0458662526f1447043d65feb55cd4 /src/rhctl/conf.go
parentb1350a8096e1d7d11408b19b438ca09912e03c2d (diff)
make reconcile simpler - needs testing...
Diffstat (limited to 'src/rhctl/conf.go')
-rw-r--r--src/rhctl/conf.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rhctl/conf.go b/src/rhctl/conf.go
index bf68fec..3cfaeac 100644
--- a/src/rhctl/conf.go
+++ b/src/rhctl/conf.go
@@ -40,13 +40,21 @@ type ConfigSwitchInputs []struct {
func (p ConfigSwitchInputs) Len() int { return len(p) }
func (p ConfigSwitchInputs) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
func (p ConfigSwitchInputs) Less(i, j int) bool { return p[i].Number < p[j].Number }
-func (p ConfigSwitchInputs) Get(server, channel string) SwitchInputNum {
+func (p ConfigSwitchInputs) GetNumber(server, channel string) (SwitchInputNum, error) {
for _, i := range p {
if i.Server == server && i.Channel == channel {
- return i.Number
+ return i.Number, nil
}
}
- return SwitchInputNum(0)
+ return SwitchInputNum(0), errors.New("no such server/channel")
+}
+func (p ConfigSwitchInputs) GetServerAndChannel(in SwitchInputNum) (string, string, error) {
+ for _, i := range p {
+ if i.Number == in {
+ return i.Server, i.Channel, nil
+ }
+ }
+ return "", "", errors.New("no such input")
}
type Config struct {