1+ // Package commands provides implementations for Drycc CLI commands.
12package commands
23
34import (
@@ -10,7 +11,7 @@ import (
1011 "github.com/drycc/controller-sdk-go/appsettings"
1112 "github.com/drycc/controller-sdk-go/domains"
1213 "github.com/drycc/controller-sdk-go/ps"
13- "github.com/drycc/workflow-cli/internal/utils "
14+ "github.com/drycc/workflow-cli/internal/loader "
1415 "github.com/drycc/workflow-cli/pkg/git"
1516 "github.com/drycc/workflow-cli/pkg/settings"
1617 "github.com/drycc/workflow-cli/pkg/webbrowser"
@@ -59,7 +60,6 @@ func (d *DryccCmd) AppCreate(id, remote string, noRemote bool) error {
5960// AppsList lists apps on the Drycc controller.
6061func (d * DryccCmd ) AppsList (results int ) error {
6162 s , err := settings .Load (d .ConfigFile )
62-
6363 if err != nil {
6464 return err
6565 }
@@ -91,8 +91,7 @@ func (d *DryccCmd) AppsList(results int) error {
9191
9292// AppInfo prints info about app.
9393func (d * DryccCmd ) AppInfo (appID string ) error {
94- appID , s , err := utils .LoadAppSettings (d .ConfigFile , appID )
95-
94+ appID , s , err := loader .LoadAppSettings (d .ConfigFile , appID )
9695 if err != nil {
9796 return err
9897 }
@@ -177,8 +176,7 @@ func (d *DryccCmd) AppInfo(appID string) error {
177176
178177// AppOpen opens an app in the default webbrowser.
179178func (d * DryccCmd ) AppOpen (appID string ) error {
180- appID , s , err := utils .LoadAppSettings (d .ConfigFile , appID )
181-
179+ appID , s , err := loader .LoadAppSettings (d .ConfigFile , appID )
182180 if err != nil {
183181 return err
184182 }
@@ -192,7 +190,7 @@ func (d *DryccCmd) AppOpen(appID string) error {
192190 return fmt .Errorf (noDomainAssignedMsg , appID )
193191 }
194192
195- if ! ( strings .HasPrefix (u , "http://" ) || strings .HasPrefix (u , "https://" ) ) {
193+ if ! strings .HasPrefix (u , "http://" ) && ! strings .HasPrefix (u , "https://" ) {
196194 u = "http://" + u
197195 }
198196
@@ -201,8 +199,7 @@ func (d *DryccCmd) AppOpen(appID string) error {
201199
202200// AppRun runs a one time command in the app.
203201func (d * DryccCmd ) AppRun (appID , command string , volumeVars []string , timeout , expires uint32 ) error {
204- appID , s , err := utils .LoadAppSettings (d .ConfigFile , appID )
205-
202+ appID , s , err := loader .LoadAppSettings (d .ConfigFile , appID )
206203 if err != nil {
207204 return err
208205 }
@@ -219,8 +216,8 @@ func (d *DryccCmd) AppRun(appID, command string, volumeVars []string, timeout, e
219216 return nil
220217}
221218
222- func parseMount (volumeVars []string ) (map [string ]interface {} , error ) {
223- volumeMap := make (map [string ]interface {} )
219+ func parseMount (volumeVars []string ) (map [string ]any , error ) {
220+ volumeMap := make (map [string ]any )
224221
225222 regex := regexp .MustCompile (`^([A-z_]+[A-z0-9_]*):([\s\S]*)$` )
226223 for _ , volume := range volumeVars {
@@ -239,14 +236,12 @@ func (d *DryccCmd) AppDestroy(appID, confirm string) error {
239236 gitSession := false
240237
241238 s , err := settings .Load (d .ConfigFile )
242-
243239 if err != nil {
244240 return err
245241 }
246242
247243 if appID == "" {
248244 appID , err = git .DetectAppName (git .DefaultCmd , s .Client .ControllerURL .Host )
249-
250245 if err != nil {
251246 return err
252247 }
@@ -286,8 +281,7 @@ func (d *DryccCmd) AppDestroy(appID, confirm string) error {
286281
287282// AppTransfer transfers app ownership to another user.
288283func (d * DryccCmd ) AppTransfer (appID , username string ) error {
289- appID , s , err := utils .LoadAppSettings (d .ConfigFile , appID )
290-
284+ appID , s , err := loader .LoadAppSettings (d .ConfigFile , appID )
291285 if err != nil {
292286 return err
293287 }
0 commit comments