diff --git a/shard.lock b/shard.lock index 6189fcd..61ded6a 100644 --- a/shard.lock +++ b/shard.lock @@ -68,3 +68,7 @@ shards: git: https://github.com/crystal-lang/crystal-sqlite3.git version: 0.16.0 + tallboy: + git: https://github.com/epoch/tallboy.git + version: 0.9.3 + diff --git a/shard.yml b/shard.yml index b9828c9..5b6b536 100644 --- a/shard.yml +++ b/shard.yml @@ -39,3 +39,5 @@ dependencies: github: hkalexling/image_size.cr koa: github: hkalexling/koa + tallboy: + github: epoch/tallboy diff --git a/src/mango.cr b/src/mango.cr index bcce252..ed28401 100644 --- a/src/mango.cr +++ b/src/mango.cr @@ -3,9 +3,10 @@ require "./queue" require "./server" require "./main_fiber" require "./mangadex/*" +require "./plugin/*" require "option_parser" require "clim" -require "./plugin/*" +require "tallboy" MANGO_VERSION = "0.17.1" @@ -110,18 +111,13 @@ class CLI < Clim password.not_nil!, opts.admin when "list" users = storage.list_users - name_length = users.map(&.[0].size).max? || 0 - l_cell_width = ["username".size, name_length].max - r_cell_width = "admin access".size - header = " #{"username".ljust l_cell_width} | admin access " - puts "-" * header.size - puts header - puts "-" * header.size - users.each do |name, admin| - puts " #{name.ljust l_cell_width} | " \ - "#{admin.to_s.ljust r_cell_width} " + table = Tallboy.table do + header ["username", "admin access"] + users.each do |name, admin| + row [name, admin] + end end - puts "-" * header.size + puts table when nil puts opts.help_string else