File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
- 0.1.0
1
+ 0.1.1
Original file line number Diff line number Diff line change 15
15
package cmd
16
16
17
17
import (
18
+ "fmt"
19
+
18
20
"github.com/codefresh-io/go-sdk/internal"
19
21
"github.com/codefresh-io/go-sdk/pkg/codefresh"
20
22
humanize "github.com/dustin/go-humanize"
@@ -32,7 +34,7 @@ var getPipelineCmd = &cobra.Command{
32
34
client := viper .Get ("codefresh" )
33
35
codefreshClient , ok := client .(codefresh.Codefresh )
34
36
if ! ok {
35
- panic ( "Faild to create Codefresh cleint" )
37
+ internal . DieOnError ( fmt . Errorf ( "Faild to create Codefresh client" ) )
36
38
}
37
39
table := internal .CreateTable ()
38
40
table .SetHeader ([]string {"Pipeline Name" , "Created At" , "Updated At" })
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ package codefresh
2
2
3
3
import (
4
4
"fmt"
5
+ "net/url"
6
+
7
+ "github.com/codefresh-io/go-sdk/internal"
5
8
6
9
"gopkg.in/h2non/gentleman.v2"
7
10
"gopkg.in/h2non/gentleman.v2/plugins/body"
@@ -28,7 +31,9 @@ func New(opt *ClietOptions) Codefresh {
28
31
29
32
func (c * codefresh ) requestAPI (opt * requestOptions ) (* gentleman.Response , error ) {
30
33
req := c .client .Request ()
31
- req .Path (opt .path )
34
+ url , err := url .Parse (opt .path )
35
+ internal .DieOnError (err )
36
+ req .Path (url .String ())
32
37
req .Method (opt .method )
33
38
req .AddHeader ("Authorization" , c .token )
34
39
if opt .body != nil {
Original file line number Diff line number Diff line change 1
1
package utils
2
2
3
3
import (
4
+ "fmt"
5
+
6
+ "github.com/codefresh-io/go-sdk/internal"
4
7
"github.com/codefresh-io/go-sdk/pkg/codefresh"
5
8
)
6
9
7
10
func CastToCodefreshOrDie (candidate interface {}) codefresh.Codefresh {
8
11
client , ok := candidate .(codefresh.Codefresh )
9
12
if ! ok {
10
- panic ( "Failed to cast candidate to Codefresh client" )
13
+ internal . DieOnError ( fmt . Errorf ( "Failed to cast candidate to Codefresh client" ) )
11
14
}
12
15
return client
13
16
}
You can’t perform that action at this time.
0 commit comments