Skip to content

Commit

Permalink
Left pad short instance ids so that the output is more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
solarnz committed Dec 25, 2016
1 parent f940e0b commit c1642c2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ec2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit c1642c2

Please sign in to comment.