fix(cmd): rename list cmd context

pull/921/head
Adam Reese 8 years ago
parent 4d92bd086f
commit 6453c99241

@ -53,7 +53,7 @@ server's default, which may be much higher than 256. Pairing the '--max'
flag with the '--offset' flag allows you to page through results.
`
type lister struct {
type listCmd struct {
filter string
long bool
limit int
@ -65,7 +65,7 @@ type lister struct {
}
func newListCmd(client helm.Interface, out io.Writer) *cobra.Command {
list := &lister{out: out}
list := &listCmd{out: out}
cmd := &cobra.Command{
Use: "list [flags] [FILTER]",
Short: "list releases",
@ -91,7 +91,7 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command {
return cmd
}
func (l *lister) run() error {
func (l *listCmd) run() error {
sortBy := services.ListSort_NAME
if l.byDate {
sortBy = services.ListSort_LAST_RELEASED

@ -51,13 +51,13 @@ func (fl *fakeReleaseLister) ListReleases(opts ...helm.ReleaseListOption) (*rls.
func TestListRun(t *testing.T) {
tests := []struct {
name string
lister *lister
listCmd *listCmd
expected string
err bool
}{
{
name: "with a release",
lister: &lister{
listCmd: &listCmd{
client: &fakeReleaseLister{
rels: []*release.Release{
releaseMock("thomas-guide"),
@ -68,7 +68,7 @@ func TestListRun(t *testing.T) {
},
{
name: "list --long",
lister: &lister{
listCmd: &listCmd{
client: &fakeReleaseLister{
rels: []*release.Release{
releaseMock("atlas"),
@ -82,8 +82,8 @@ func TestListRun(t *testing.T) {
var buf bytes.Buffer
for _, tt := range tests {
tt.lister.out = &buf
err := tt.lister.run()
tt.listCmd.out = &buf
err := tt.listCmd.run()
if (err != nil) != tt.err {
t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err)
}

Loading…
Cancel
Save