@@ -26,7 +26,6 @@ import (
2626 "github.com/google/uuid"
2727 "github.com/radius-project/radius/pkg/cli/clierrors"
2828 "github.com/radius-project/radius/pkg/cli/cmd/commonflags"
29- "github.com/radius-project/radius/pkg/cli/config"
3029 "github.com/radius-project/radius/pkg/cli/output"
3130 "github.com/radius-project/radius/pkg/cli/workspaces"
3231 "github.com/radius-project/radius/pkg/ucp/resources"
@@ -169,22 +168,16 @@ func ReadEnvironmentNameArgs(cmd *cobra.Command, args []string) (string, error)
169168//
170169// - '--application' flag
171170// - first positional arg
172- // - workspace default application
173- // - directory config application
174171//
175172
176- // RequireApplicationArgs checks if an application name is provided as an argument, and if not, checks if a default
177- // application is set in the workspace. If no application name is provided, it returns an error.
173+ // RequireApplicationArgs checks if an application name is provided as an argument or via the '--application' flag.
174+ // If no application name is provided, it returns an error.
178175func RequireApplicationArgs (cmd * cobra.Command , args []string , workspace workspaces.Workspace ) (string , error ) {
179176 applicationName , err := ReadApplicationNameArgs (cmd , args )
180177 if err != nil {
181178 return "" , err
182179 }
183180
184- if applicationName == "" {
185- applicationName = workspace .DirectoryConfig .Workspace .Application
186- }
187-
188181 if applicationName == "" {
189182 return "" , fmt .Errorf ("no application name provided, " +
190183 "pass in an application name with '-a/--application'" )
@@ -193,26 +186,18 @@ func RequireApplicationArgs(cmd *cobra.Command, args []string, workspace workspa
193186 return applicationName , nil
194187}
195188
196- // ReadApplicationName reads the application name from the following sources in priority order and returns
189+ // ReadApplicationName reads the application name from the '--application' flag and returns
197190// the empty string if no application is set.
198191//
199- // - '--application' flag
200- // - workspace default application
201- // - directory config application
202- //
203192
204- // ReadApplicationName reads the application name from the command line flag and, if not provided, from the workspace
205- // configuration. It returns an error if the flag is not set correctly.
193+ // ReadApplicationName reads the application name from the command line.
194+ // It returns an error if the flag is not set correctly.
206195func ReadApplicationName (cmd * cobra.Command , workspace workspaces.Workspace ) (string , error ) {
207196 applicationName , err := cmd .Flags ().GetString ("application" )
208197 if err != nil {
209198 return "" , err
210199 }
211200
212- if applicationName == "" {
213- applicationName = workspace .DirectoryConfig .Workspace .Application
214- }
215-
216201 return applicationName , nil
217202}
218203
@@ -385,7 +370,7 @@ func RequireOutput(cmd *cobra.Command) (string, error) {
385370
386371// RequireWorkspace reads the workspace name from the command flags, retrieves the workspace from the configuration, and
387372// returns it, or a fallback workspace if none is found. It also handles any errors that may occur during the process.
388- func RequireWorkspace (cmd * cobra.Command , config * viper.Viper , dc * config. DirectoryConfig ) (* workspaces.Workspace , error ) {
373+ func RequireWorkspace (cmd * cobra.Command , config * viper.Viper ) (* workspaces.Workspace , error ) {
389374 name , err := cmd .Flags ().GetString ("workspace" )
390375 if err != nil {
391376 return nil , err
@@ -407,10 +392,6 @@ func RequireWorkspace(cmd *cobra.Command, config *viper.Viper, dc *config.Direct
407392 ws = workspaces .MakeFallbackWorkspace ()
408393 }
409394
410- if dc != nil {
411- ws .DirectoryConfig = * dc
412- }
413-
414395 return ws , nil
415396}
416397
0 commit comments