WIP: feature/1-add-support-for-fs-crud #47

Draft
glenux wants to merge 53 commits from feature/1-add-support-for-fs-crud into develop
2 changed files with 16 additions and 2 deletions
Showing only changes of commit 60a7356f8b - Show all commits

View file

@ -30,13 +30,22 @@ module GX
Parsers::RootParser.new.build(parser, breadcrumbs, @config) Parsers::RootParser.new.build(parser, breadcrumbs, @config)
end end
pparser.parse(args) pparser.parse(args)
rescue e : OptionParser::MissingOption
STDERR.puts "ERROR: #{e.message}".colorize(:red)
exit(1)
end end
def run def run
command = CommandFactory.create_command(@config, @config.mode) command = CommandFactory.create_command(@config, @config.mode)
abort("ERROR: unknown command for mode #{@config.mode}") if command.nil? abort("ERROR: unknown command for mode #{@config.mode}") if command.nil?
command.try &.execute command.execute
rescue e : ArgumentError
STDERR.puts "ERROR: #{e.message}".colorize(:red)
exit(1)
rescue e : Exception
STDERR.puts "ERROR: #{e.message}".colorize(:red)
exit(1)
end end
end end
end end

View file

@ -102,7 +102,12 @@ module GX
file_data = File.read(config_path) file_data = File.read(config_path)
file_patched = Crinja.render(file_data, {"env" => ENV.to_h}) file_patched = Crinja.render(file_data, {"env" => ENV.to_h})
begin
root = Models::RootConfig.from_yaml(file_patched) root = Models::RootConfig.from_yaml(file_patched)
rescue ex : YAML::ParseException
STDERR.puts "Error parsing configuration file: #{ex.message}".colorize(:red)
exit(1)
end
mount_point_base_safe = root.global.mount_point_base mount_point_base_safe = root.global.mount_point_base
raise Models::InvalidMountpointError.new("Invalid global mount point") if mount_point_base_safe.nil? raise Models::InvalidMountpointError.new("Invalid global mount point") if mount_point_base_safe.nil?