Sha256: 1219d3c5a323ec59fd441a1a6cbef1034d3ee4ed3ebd45ebf3b4d3edba1d1287

Contents?: true

Size: 851 Bytes

Versions: 54

Compression:

Stored size: 851 Bytes

Contents

require "vmc/cli/user/base"

module VMC::User
  class Create < Base
    desc "Create a user"
    group :admin, :user, :hidden => true
    input :email, :desc => "User email", :argument => :optional
    input :password, :desc => "User password"
    input :verify, :desc => "Repeat password"
    def create_user
      email = input[:email]
      password = input[:password]

      if !force? && password != input[:verify]
        fail "Passwords don't match."
      end

      with_progress("Creating user") do
        client.register(email, password)
      end
    end

    alias_command :add_user, :create_user

    private

    def ask_email
      ask("Email")
    end

    def ask_password
      ask("Password", :echo => "*", :forget => true)
    end

    def ask_verify
      ask("Verify Password", :echo => "*", :forget => true)
    end
  end
end

Version data entries

54 entries across 54 versions & 4 rubygems

Version Path
cloulu-1.0.0 lib/vmc/cli/user/create.rb
cloulu-0.7.0 lib/vmc/cli/user/create.rb
cloulu-0.6.6 lib/vmc/cli/user/create.rb
cloulu-0.6.5 lib/vmc/cli/user/create.rb
cloulu-0.6.1 lib/vmc/cli/user/create.rb
cloulu-0.6.0 lib/vmc/cli/user/create.rb
cloulu-0.5.1 lib/vmc/cli/user/create.rb
cloulu-0.5.0 lib/vmc/cli/user/create.rb
cloulu-0.3.0 lib/vmc/cli/user/create.rb
cloulu-0.2.6 lib/vmc/cli/user/create.rb
cloulu-0.2.5 lib/vmc/cli/user/create.rb
cloulu-0.2.4 lib/vmc/cli/user/create.rb
cloulu-0.2.3 lib/vmc/cli/user/create.rb
cloulu-0.2.1 lib/vmc/cli/user/create.rb
cloulu-0.2.0 lib/vmc/cli/user/create.rb
cloulu-0.1.6 lib/vmc/cli/user/create.rb
cloulu-0.1.5 lib/vmc/cli/user/create.rb
cloulu-0.1.2 lib/vmc/cli/user/create.rb
cloulu-0.1.1 lib/vmc/cli/user/create.rb
vmc-0.5.1 lib/vmc/cli/user/create.rb