Skip to content

Commit 774f4fc

Browse files
committed
[324] Revert create cluster option name
1 parent d64e62b commit 774f4fc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/uffizzi/cli/cluster.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def list
2626
end
2727

2828
desc 'create [NAME]', 'Create a cluster'
29+
method_option :name, type: :string, required: false, aliases: '-n'
2930
method_option :kubeconfig, type: :string, required: false, aliases: '-k'
3031
method_option :manifest, type: :string, required: false, aliases: '-m'
3132
method_option :'update-current-context', type: :boolean, required: false, default: true
@@ -103,9 +104,17 @@ def handle_list_command(project_slug)
103104
end
104105
end
105106

107+
# rubocop:disable Metrics/PerceivedComplexity
106108
def handle_create_command(project_slug, command_args)
107109
Uffizzi.ui.disable_stdout if Uffizzi.ui.output_format
108-
cluster_name = command_args[:name] || ClusterService.generate_name
110+
111+
if options[:name]
112+
msg = 'DEPRECATION WARNING: The --name option is deprecated and will be removed in the newer versions.' \
113+
' Please use a positional argument instead: uffizzi cluster create my-awesome-name'
114+
Uffizzi.ui.say(msg)
115+
end
116+
117+
cluster_name = command_args[:name] || options[:name] || ClusterService.generate_name
109118
creation_source = options[:"creation-source"] || MANUAL
110119

111120
unless ClusterService.valid_name?(cluster_name)
@@ -132,6 +141,7 @@ def handle_create_command(project_slug, command_args)
132141
rescue SystemExit, Interrupt, SocketError
133142
handle_interrupt_creation(cluster_name, ConfigFile.read_option(:server), project_slug)
134143
end
144+
# rubocop:enable Metrics/PerceivedComplexity
135145

136146
def handle_describe_command(project_slug, command_args)
137147
cluster_data = fetch_cluster_data(project_slug, command_args[:cluster_name])

0 commit comments

Comments
 (0)