lib/dockerun/command/run.rb in dockerun-0.1.14 vs lib/dockerun/command/run.rb in dockerun-0.1.15

- old
+ new

@@ -14,10 +14,11 @@ include TTY::Option include TR::CondUtils include CommandHelper::DockerContainerHelper include DockerCommandFactoryHelper include CommandHelper::DockerImageHelper + include CliHelper::CliPrompt usage do program "dockerun" command "run" desc "Run docker instance from here" @@ -103,23 +104,36 @@ selContName = run_docker_container(imageName, selContName) do |ops, *args| case ops when :new_container_name cli.ask("Please provide a new container name : ", required: true) + when :container_name_exist cli.yes?("Container name '#{args.first}' already exist. Proceed with existing?") + when :volume_mapping_required? - cli.yes?("Is there any volume mapping required? ") + cli.say "\nCurrent configured mount point(s) : \n" + config.container_mount_points(imageName, selContName).each do |mp| + cli.say " * (Local) #{mp.keys[0]} ==> (Container) #{mp.values[0]}" + end + cli.yes?("\nIs there any volume mapping required? ") + + when :existing_volume_mapping + config.container_mount_points(imageName, selContName) + when :source_prompt cli.ask("Directory to share with docker : ", required: true) + when :destination_prompt src = args.first srcDir = File.basename(src) cli.ask("Directory to show inside docker : ", required: true, value: "/opt/#{srcDir}") when :add_mount_to_container config.add_mount_to_container(imageName, *args) + when :add_more_volume_mapping? cli.yes?("Add more volume mapping?") + end end config.add_container(imageName, selContName)