bin/qcmd in qcmd-0.1.8 vs bin/qcmd in qcmd-0.1.9
- old
+ new
@@ -1,10 +1,12 @@
#!/usr/bin/env ruby
require 'qcmd'
require 'trollop'
+# require 'profile'
+
VERSION_STRING = "qcmd #{ Qcmd::VERSION } (c) 2012 Figure 53, Baltimore, MD."
opts = Trollop::options do
version VERSION_STRING
opt :verbose, 'Use verbose mode', :default => false
@@ -13,10 +15,12 @@
opt :workspace, "Automatically try to connect to the workspace with the given name", :type => :string
opt :workspace_passcode, "Use the given workspace passcode", :type => :integer
opt :command, "Execute a single command and exit", :type => :string
end
+Qcmd.log_level = :info
+
if opts[:verbose]
Qcmd.log_level = :debug
end
if opts[:debug]
@@ -25,23 +29,34 @@
end
# browse local network and check for qlab + qlab workspaces
Qcmd::History.load
+Qcmd::Network.init
if !opts[:machine_given]
Qcmd.ascii_qlab
Qcmd.print
Qcmd.print Qcmd.centered_text(VERSION_STRING)
-
Qcmd::Network.browse_and_display opts
else
- Qcmd::Network.browse
+ if Qcmd::Network::IPV4_MATCHER =~ opts[:machine]
+ Qcmd.debug "[bin/qcmd] given machine name matches IP address pattern"
+ elsif opts[:machine] == 'localhost'
+ opts[:machine] = '127.0.0.1'
+ else
+ Qcmd.debug "[bin/qcmd] browsing network #{ opts[:machine] }"
+ Qcmd::Network.browse
+ end
end
if opts[:command_given] && !(opts[:machine_given] && opts[:workspace_given])
Qcmd.print_wrapped("if you give a command, you must also give a
machine name and a workspace name to connect to")
+elsif opts[:command_given] && opts[:machine_given] && opts[:workspace_given]
+ opts[:command_mode] = true
end
-
+# Profiler__::start_profile
Qcmd::CLI.launch opts
+# Profiler__::stop_profile
+# Profiler__::print_profile($stderr)