A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ksonnet/ksonnet/commit/e943ae55d4fe256c8330a047ce8426ad9dac110c below:

Merge pull request #577 from bryanl/cli-errors · ksonnet/ksonnet@e943ae5 · GitHub

This repository was archived by the owner on Sep 9, 2020. It is now read-only.

File tree Expand file treeCollapse file tree 5 files changed

+18

-6

lines changed

Filter options

Expand file treeCollapse file tree 5 files changed

+18

-6

lines changed Original file line number Diff line number Diff line change

@@ -42,12 +42,11 @@ func main() {

42 42

}

43 43

log.SetFormatter(logFmt)

44 44 45 -

log.Error(err.Error())

46 - 47 45

switch err {

48 46

case actions.ErrDiffFound:

49 47

os.Exit(10)

50 48

default:

49 +

log.Error(err.Error())

51 50

os.Exit(1)

52 51

}

53 52

}

Original file line number Diff line number Diff line change

@@ -116,7 +116,8 @@ func (d *Diff) Run() error {

116 116

return err

117 117

}

118 118 119 -

if buf.String() != "" {

119 +

if s := buf.String(); s != "" {

120 +

fmt.Fprintln(d.out, s)

120 121

return ErrDiffFound

121 122

}

122 123 Original file line number Diff line number Diff line change

@@ -36,6 +36,7 @@ func TestDiff(t *testing.T) {

36 36

src2 string

37 37

eLocation1 string

38 38

eLocation2 string

39 +

diffText string

39 40

isNewError bool

40 41

isRunError bool

41 42

}{

@@ -52,6 +53,15 @@ func TestDiff(t *testing.T) {

52 53

eLocation1: "local:default",

53 54

eLocation2: "remote:default",

54 55

},

56 +

{

57 +

name: "diff detected",

58 +

src1: "local:default",

59 +

src2: "remote:default",

60 +

eLocation1: "local:default",

61 +

eLocation2: "remote:default",

62 +

diffText: "+foo\n-bar\nbaz\n",

63 +

isRunError: true,

64 +

},

55 65

}

56 66 57 67

for _, tc := range cases {

@@ -80,13 +90,14 @@ func TestDiff(t *testing.T) {

80 90

assert.Equal(t, tc.eLocation1, l1.String(), "location1")

81 91

assert.Equal(t, tc.eLocation2, l2.String(), "location2")

82 92 83 -

r := strings.NewReader("")

93 +

r := strings.NewReader(tc.diffText)

84 94

return r, nil

85 95

}

86 96 87 97

err = d.Run()

88 98

if tc.isRunError {

89 -

require.Error(t, err)

99 +

assert.Error(t, err)

100 +

assert.NotEmpty(t, buf.String())

90 101

return

91 102

}

92 103 Original file line number Diff line number Diff line change

@@ -52,6 +52,7 @@ application configuration to remote clusters.

52 52

----

53 53

`,

54 54

SilenceErrors: true,

55 +

SilenceUsage: true,

55 56

PersistentPreRunE: func(cmd *cobra.Command, args []string) error {

56 57

goflag.CommandLine.Parse([]string{})

57 58

flags := cmd.Flags()

Original file line number Diff line number Diff line change

@@ -41,7 +41,7 @@ type Differ struct {

41 41

// DefaultDiff runs diff with default options.

42 42

func DefaultDiff(a app.App, config *client.Config, l1 *Location, l2 *Location) (io.Reader, error) {

43 43

differ := New(a, config)

44 -

return differ.Diff(l1, l2)

44 +

return differ.Diff(l2, l1)

45 45

}

46 46 47 47

// New creates an instance of Differ.

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4