35 lines
812 B
C#
35 lines
812 B
C#
// See https://aka.ms/new-console-template for more information
|
|
using CommandLine;
|
|
using PhotoFileOrganizer;
|
|
|
|
#if DEBUG
|
|
var DEBUG_ARG = new string[]
|
|
{
|
|
"-i", "d:\\사진정리후",
|
|
"-o", "d:\\사진정리",
|
|
};
|
|
Parser.Default.ParseArguments<FileOrganizerOptions>(DEBUG_ARG)
|
|
.WithParsed(RunOptions)
|
|
.WithNotParsed(HandleParseError);
|
|
#else
|
|
Parser.Default.ParseArguments<FileOrganizerOptions>(args)
|
|
.WithParsed(RunOptions)
|
|
.WithNotParsed(HandleParseError);
|
|
#endif
|
|
|
|
void RunOptions(FileOrganizerOptions opts)
|
|
{
|
|
try
|
|
{
|
|
var organizer = new FileOrganizerCommand(opts);
|
|
organizer.Execute();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine(ex);
|
|
}
|
|
}
|
|
void HandleParseError(IEnumerable<Error> errs)
|
|
{
|
|
foreach (var err in errs) Console.WriteLine(err);
|
|
} |