@@ -4,10 +4,10 @@ import (
44 "fmt"
55 "io"
66 "io/ioutil"
7- "os"
87 "path/filepath"
98 "strconv"
109 "strings"
10+ "text/tabwriter"
1111
1212 "github.com/deis/controller-sdk-go/api"
1313 "github.com/deis/controller-sdk-go/keys"
@@ -34,9 +34,12 @@ func (d DeisCmd) KeysList(results int) error {
3434
3535 d .Printf ("=== %s Keys%s" , s .Username , limitCount (len (keys ), count ))
3636
37+ w := tabwriter .NewWriter (d .WOut , 0 , 8 , 1 , ' ' , 0 )
38+
3739 for _ , key := range keys {
38- d . Printf ( "%s %s...%s\n " , key .ID , key .Public [:16 ], key .Public [len (key .Public )- 10 :])
40+ fmt . Fprintf ( w , "%s\t %s...%s\n " , key .ID , key .Public [:16 ], key .Public [len (key .Public )- 10 :])
3941 }
42+ w .Flush ()
4043 return nil
4144}
4245
@@ -74,7 +77,7 @@ func (d DeisCmd) KeyAdd(keyLocation string) error {
7477 if err != nil {
7578 return err
7679 }
77- key , err = chooseKey (ks , os . Stdin , d .WOut )
80+ key , err = chooseKey (ks , d . WIn , d .WOut )
7881 if err != nil {
7982 return err
8083 }
@@ -125,7 +128,7 @@ func chooseKey(keys []api.KeyCreateRequest, input io.Reader,
125128 var filename string
126129
127130 fmt .Fprint (wOut , "Enter the path to the pubkey file: " )
128- fmt .Scanln ( & filename )
131+ fmt .Fscanln ( input , & filename )
129132
130133 return getKey (filename )
131134 }
0 commit comments