snag/source/app.d
2025-05-23 20:48:14 +03:00

35 lines
685 B
D
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import snapd;
import commandr;
import std.file;
import std.stdio : writeln;
import core.stdc.stdlib : EXIT_SUCCESS, EXIT_FAILURE;
private string programName = "snapd";
int main(string[] args)
{
auto argumets = new Program(programName, snapdVersion)
.add(new Option("c", "config", "Сonfiguration file path")
.optional
.validateEachWith(
opt => opt.exists && opt.isFile,
"A JSON file path must be provided"
)
)
.parse(args);
string configFile = argumets.option("config", "snapd.json");
SnapdConfig config;
try {
config = new SnapdConfig(configFile);
} catch (SnapdConfigException e) {
e.print();
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}