lib/zold/commands/create.rb in zold-0.6.3 vs lib/zold/commands/create.rb in zold-0.6.4

- old
+ new

@@ -16,10 +16,13 @@ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +require 'slop' +require 'rainbow' +require_relative 'args' require_relative '../wallet' require_relative '../log' require_relative '../id' # CREATE command. @@ -42,14 +45,10 @@ 'The location of RSA public key (default: ~/.ssh/id_rsa.pub)', require: true, default: '~/.ssh/id_rsa.pub' o.bool '--help', 'Print instructions' end - if opts.help? - @log.info(opts.to_s) - return - end - mine = opts.arguments[1..-1] + mine = Args.new(opts, @log).take || return create(mine.empty? ? Id.new : Id.new(mine[0]), opts) end def create(id, opts) wallet = @wallets.find(id)