set table render

master
Alexander Popov 6 months ago
parent 2a7a225024
commit 716d5634c3
Signed by: Alexander Popov
GPG Key ID: D8C9B59A9F04A70C

@ -13,6 +13,10 @@ begin
ARGV_VARS.short = true
end
parser.on "-r RENDER", "Table render (unicode, ascii, markdown)" do |render|
ARGV_VARS.render = render
end
parser.on "-d", "Daemon" do
ARGV_VARS.daemon = true
end

@ -7,6 +7,7 @@ class CONFIG
def initialize(daemon : Bool, short : Bool)
@daemon = daemon
@short = short
@render = "unicode"
end
def daemon=(daemon : Bool)
@ -17,13 +18,21 @@ class CONFIG
@short = short
end
def daemon(daemon : Bool)
def render=(render : String)
@render = render
end
def daemon
return @daemon
end
def short(short : Bool)
def short
return @short
end
def render
return @render
end
end
ARGV_VARS = CONFIG.new(false, false)

@ -45,7 +45,13 @@ if File.exists?(CONFIG_PATH)
}
end
puts repos_table
if ARGV_VARS.render == "ascii"
puts repos_table.render(:ascii)
elsif ARGV_VARS.render == "markdown"
puts repos_table.render(:markdown)
else
puts repos_table.render(:unicode)
end
end
else
Dir.mkdir_p(File.dirname(CONFIG_PATH))

Loading…
Cancel
Save