Make the user listing command handles empty DB

This commit is contained in:
Alex Ling 2020-06-03 08:19:40 +00:00
parent 54123917af
commit fe799f30c8
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ class CLI < Clim
password.not_nil!, opts.admin password.not_nil!, opts.admin
when "list" when "list"
users = storage.list_users users = storage.list_users
name_length = users.map(&.[0].size).max name_length = users.map(&.[0].size).max? || 0
l_cell_width = ["username".size, name_length].max l_cell_width = ["username".size, name_length].max
r_cell_width = "admin access".size r_cell_width = "admin access".size
header = " #{"username".ljust l_cell_width} | admin access " header = " #{"username".ljust l_cell_width} | admin access "