From c1642c236c6192d4d5aa26abf1e05ab25aa641ee Mon Sep 17 00:00:00 2001 From: Chris Trotman Date: Sun, 25 Dec 2016 17:13:41 +1100 Subject: [PATCH] Left pad short instance ids so that the output is more consistent --- ec2.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ec2.go b/ec2.go index 92476e1..3d573ed 100644 --- a/ec2.go +++ b/ec2.go @@ -67,13 +67,14 @@ func (e *Ec2fzf) StringFromInstance(i *ec2.Instance) (string, error) { return "", err } - return fmt.Sprintf("%s: %s", *i.InstanceId, buffer.String()), nil + return fmt.Sprintf("%19s: %s", *i.InstanceId, buffer.String()), nil } func InstanceIdFromString(s string) (string, error) { i := strings.Index(s, ":") + if i < 0 { return "", fmt.Errorf("Unable to find instance id") } - return s[0:i], nil + return strings.TrimSpace(s[0:i]), nil }