12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/vkit/cli/commands/registry_export_command.rb', line 12
def call(dir:, out: nil, force: false)
with_auth do
ensure_project!(dir)
dir = File.expand_path(dir)
path = out ? File.expand_path(out, dir) : File.join(dir, DEFAULT_PATH)
if File.exist?(path) && !force
decision = handle_existing_registry(dir: dir, path: path)
return if decision == :abort
end
user = credential_store.user
org = user["organization_slug"]
registry_data = authenticated_client.get(
"/api/v1/orgs/#{org}/registries/export"
)
FileUtils.mkdir_p(File.dirname(path))
File.write(path, registry_data.to_yaml)
puts "✅ Registry exported to:"
puts " #{relative(dir, path)}"
end
rescue StandardError => e
puts "❌ Error: #{e.message}"
exit 1
end
|