summaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands
diff options
context:
space:
mode:
Diffstat (limited to 'lib/leap_cli/commands')
-rw-r--r--lib/leap_cli/commands/common.rb61
-rw-r--r--lib/leap_cli/commands/new.rb2
2 files changed, 1 insertions, 62 deletions
diff --git a/lib/leap_cli/commands/common.rb b/lib/leap_cli/commands/common.rb
deleted file mode 100644
index 7bf49db..0000000
--- a/lib/leap_cli/commands/common.rb
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# Some common helpers available to all LeapCli::Commands
-#
-# This also includes utility methods, and makes all instance
-# methods available as class methods.
-#
-
-module LeapCli
- module Commands
-
- extend self
- extend LeapCli::Log
- extend LeapCli::Util
- extend LeapCli::Util::RemoteCommand
-
- protected
-
- def path(name)
- Path.named_path(name)
- end
-
- #
- # keeps prompting the user for a numbered choice, until they pick a good one or bail out.
- #
- # block is yielded and is responsible for rendering the choices.
- #
- def numbered_choice_menu(msg, items, &block)
- while true
- say("\n" + msg + ':')
- items.each_with_index &block
- say("q. quit")
- index = ask("number 1-#{items.length}> ")
- if index.empty?
- next
- elsif index =~ /q/
- bail!
- else
- i = index.to_i - 1
- if i < 0 || i >= items.length
- bail!
- else
- return i
- end
- end
- end
- end
-
- def parse_node_list(nodes)
- if nodes.is_a? Config::Object
- Config::ObjectList.new(nodes)
- elsif nodes.is_a? Config::ObjectList
- nodes
- elsif nodes.is_a? String
- manager.filter!(nodes)
- else
- bail! "argument error"
- end
- end
-
- end
-end \ No newline at end of file
diff --git a/lib/leap_cli/commands/new.rb b/lib/leap_cli/commands/new.rb
index 838b80e..5c9fd74 100644
--- a/lib/leap_cli/commands/new.rb
+++ b/lib/leap_cli/commands/new.rb
@@ -54,7 +54,7 @@ module LeapCli; module Commands
unless directory && directory.any?
help! "Directory name is required."
end
- unless File.exists?(directory)
+ unless File.exist?(directory)
if global[:yes] || agree("Create directory #{directory}? ")
ensure_dir directory
else