diff options
author | elijah <elijah@riseup.net> | 2012-10-09 00:01:55 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-10-09 00:01:55 -0700 |
commit | 578ac2f5dc7432317d7a022bed9d869ab89ee45c (patch) | |
tree | 3cf8d27c2e8059df33e33e9c39146e0b3db29599 /cli/lib/leap_cli/commands/init.rb | |
parent | 105fe22c2de06310e48c4827b47d38d18750ed32 (diff) |
initial code commit
Diffstat (limited to 'cli/lib/leap_cli/commands/init.rb')
-rw-r--r-- | cli/lib/leap_cli/commands/init.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/lib/leap_cli/commands/init.rb b/cli/lib/leap_cli/commands/init.rb new file mode 100644 index 0000000..75cc876 --- /dev/null +++ b/cli/lib/leap_cli/commands/init.rb @@ -0,0 +1,24 @@ +module LeapCli + module Commands + desc 'Creates a new provider configuration directory.' + arg_name '<directory>' + 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 |