mfm/src/main.cr
Glenn f94d0f1f39
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
fix: add support for global config file
Refs: #14
2023-11-18 19:32:12 +01:00

40 lines
791 B
Crystal

# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
require "yaml"
require "colorize"
require "json"
require "log"
require "./filesystems/gocryptfs"
require "./config"
require "./cli"
struct BaseFormat < Log::StaticFormatter
def run
string @entry.severity.label.downcase
string "("
source
string "): "
message
end
end
Log.setup do |config|
backend = Log::IOBackend.new(formatter: BaseFormat)
config.bind "*", Log::Severity::Info, backend
if ENV["LOG_LEVEL"]?
level = Log::Severity.parse(ENV["LOG_LEVEL"]) || Log::Severity::Info
config.bind "*", level, backend
end
end
app = GX::Cli.new
app.parse_command_line(ARGV)
app.run