2023-10-25 12:01:46 +00:00
|
|
|
# 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>
|
|
|
|
|
2023-10-20 09:29:54 +00:00
|
|
|
require "yaml"
|
|
|
|
require "colorize"
|
|
|
|
require "json"
|
2023-11-18 18:32:12 +00:00
|
|
|
require "log"
|
2023-10-20 09:29:54 +00:00
|
|
|
|
2023-10-24 12:49:46 +00:00
|
|
|
require "./filesystems/gocryptfs"
|
2023-10-22 21:23:56 +00:00
|
|
|
require "./config"
|
|
|
|
require "./cli"
|
2023-10-20 09:29:54 +00:00
|
|
|
|
2023-11-18 18:32:12 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2023-10-22 21:23:56 +00:00
|
|
|
app = GX::Cli.new
|
2023-10-23 21:11:12 +00:00
|
|
|
app.parse_command_line(ARGV)
|
2023-10-22 21:23:56 +00:00
|
|
|
app.run
|
2023-10-20 09:29:54 +00:00
|
|
|
|
|
|
|
|