summaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands/project.rb
blob: 8ec96257cec562ce2d776448dcf194372f38e547 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module LeapCli
  module Commands

    desc 'Creates a new provider directory.'
    arg_name '<directory>'
    skips_pre
    command :'new-provider' do |c|
      c.action do |global_options,options,args|
        directory = args.first
        unless directory && directory.any?
          help! "Directory name is required."
        end
        directory = File.expand_path(directory)
        if File.exists?(directory)
          raise "#{directory} already exists."
        end
        if agree("Create directory '#{directory}'? ")
          LeapCli.init(directory)
        else
          puts "OK, bye."
        end
      end
    end
  end
end