From 73b126976ad7843eb47a84944cf191bf05b14216 Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 9 Oct 2012 00:05:44 -0700 Subject: fixed paths --- lib/leap_cli/commands/init.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/leap_cli/commands/init.rb (limited to 'lib/leap_cli/commands/init.rb') diff --git a/lib/leap_cli/commands/init.rb b/lib/leap_cli/commands/init.rb new file mode 100644 index 0000000..75cc876 --- /dev/null +++ b/lib/leap_cli/commands/init.rb @@ -0,0 +1,24 @@ +module LeapCli + module Commands + desc 'Creates a new provider configuration directory.' + arg_name '' + skips_pre + command :init do |c| + c.action do |global_options,options,args| + directory = args.first + unless directory && directory.any? + help_now! "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 \ No newline at end of file -- cgit v1.2.3