@@ -4,14 +4,15 @@ import (
4
4
"fmt"
5
5
"io/ioutil"
6
6
"path"
7
- "time"
8
7
"strings"
8
+ "time"
9
9
10
10
"github.com/spf13/cobra"
11
11
12
12
"github.com/ovh/cds/cli"
13
13
"github.com/ovh/cds/sdk"
14
14
actionSDK "github.com/ovh/cds/sdk/action"
15
+ "github.com/ovh/cds/sdk/cdsclient"
15
16
"github.com/ovh/cds/sdk/exportentities"
16
17
"github.com/ovh/cds/sdk/slug"
17
18
)
@@ -110,20 +111,20 @@ func actionUsageRun(v cli.Values) (cli.ListResult, error) {
110
111
111
112
type ActionUsageDisplay struct {
112
113
Type string `cli:"Type"`
113
- Path string `cli:"Path"`
114
+ Path string `cli:"Path"`
114
115
}
115
116
116
117
au := []ActionUsageDisplay {}
117
118
for _ , v := range usages .Pipelines {
118
119
au = append (au , ActionUsageDisplay {
119
- Type : "pipeline" ,
120
- Path : strings .Replace (fmt .Sprintf ("%s - %s - %s" , v .ProjectName , v .PipelineName , v .ActionName )," " ," " ,- 1 ),
120
+ Type : "pipeline" ,
121
+ Path : strings .Replace (fmt .Sprintf ("%s - %s - %s" , v .ProjectName , v .PipelineName , v .ActionName ), " " , " " , - 1 ),
121
122
})
122
123
}
123
124
for _ , v := range usages .Actions {
124
125
au = append (au , ActionUsageDisplay {
125
- Type : "action" ,
126
- Path : fmt .Sprintf ("%s/%s" , v .GroupName , v .ParentActionName ),
126
+ Type : "action" ,
127
+ Path : fmt .Sprintf ("%s/%s" , v .GroupName , v .ParentActionName ),
127
128
})
128
129
}
129
130
return cli .AsListResult (au ), nil
@@ -243,9 +244,8 @@ func actionImportRun(v cli.Values) error {
243
244
return err
244
245
}
245
246
defer contentFile .Close () //nolint
246
- formatStr , _ := exportentities .GetFormatStr (format )
247
247
248
- if err := client .ActionImport (contentFile , formatStr ); err != nil {
248
+ if err := client .ActionImport (contentFile , cdsclient . ContentType ( format . ContentType ()) ); err != nil {
249
249
return err
250
250
}
251
251
@@ -274,7 +274,7 @@ func actionExportRun(v cli.Values) error {
274
274
return err
275
275
}
276
276
277
- b , err := client .ActionExport (groupName , actionName , v .GetString ("format" ))
277
+ b , err := client .ActionExport (groupName , actionName , cdsclient . Format ( v .GetString ("format" ) ))
278
278
if err != nil {
279
279
return err
280
280
}
0 commit comments