henk/lib/henk/commands_generator.rb in sct-1.2.0 vs henk/lib/henk/commands_generator.rb in sct-1.3.0

- old
+ new

@@ -38,11 +38,11 @@ options.verbose = $verbose Henk::Runner.new.henk "create", options Henk::Runner.new.encrypt_config_data options.domain end end - + command :copy do |c| c.syntax = 'sct henk copy' c.description = 'Copy a client from another environment to your local environment' c.required_option '--domain DOMAIN', 'The domain to copy.' c.option '--source-environment SOURCE_ENVIRONMENT', 'The name of the source environment (currently only local allowed).' @@ -79,11 +79,11 @@ Henk::Runner.new.henk "copy", options Henk::Runner.new.encrypt_config_data options.target_domain Henk::Runner.new.synchronize_employees options.target_domain end end - + command :remove do |c| c.syntax = 'sct henk remove' c.description = 'Remove a client from your local environment.' c.required_option '--domain DOMAIN', 'The domain to remove.' c.option '--user-email EMAIL', 'The email address of the user removing the customer' @@ -100,9 +100,47 @@ c.syntax = 'sct henk list-clients' c.description = 'List all clients that are available on the dev environment' c.action do |args, options| Henk::Runner.new.list_clients + end + end + + command :"list-dumps" do |c| + c.syntax = 'sct henk list-dumps' + c.description = 'List the customer dumps currently available for import.' + + c.action do |args, options| + Henk::Runner.new.list_dumps args, options + end + end + + command :"import" do |c| + c.syntax = 'sct henk import <URL>' + c.description = 'Import a customer dump from GCP.' + + c.action do |args, options| + case args.length + when 0 + puts "Loading available customer dumps...".blue + + available_dumps = `sct henk list-dumps`.lines chomp: true + + dump_url = choose do |menu| + menu.prompt = "Please choose a dump to import:" + + for dump in available_dumps + menu.choice dump + end + end + when 1 + dump_url = args.first + else + UI.error "Expected 0 or 1 arguments, received #{args.length}: #{args}" + exit 1 + end + + Henk::Runner.new.import args, options, dump_url end end run! end