# class Chef::Knife::UserEdit

### Public Instance Methods

run() click to toggle source

    # File lib/chef/knife/user_edit.rb, line 32
    def run
      @user_name = @name_args[0]

      if @user_name.nil?
        show_usage
        ui.fatal("You must specify a user name")
        exit 1
      end

      original_user = Chef::User.load(@user_name).to_hash
      edited_user = edit_data(original_user)
      if original_user != edited_user
        user = Chef::User.from_hash(edited_user)
        user.update
        ui.msg("Saved #{user}.")
      else
        ui.msg("User unchaged, not saving.")
      end
    end