aboutsummaryrefslogtreecommitdiff
path: root/src/Commands/RootCommand.cs
blob: 1abab5a11b389cac2e53c70ea4d3ec42b68e1ea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Microsoft.Extensions.CommandLineUtils;

namespace iPhotoExtractor.Commands
{
    public class RootCommand : ICommand
    {
        public static void Configure(CommandLineApplication app)
        {
            app.Name = "iPhotoExtractor";
            app.HelpOption("-h|--help");

            app.Command("preview", PreviewCommand.Configure);
            app.Command("extract", ExtractCommand.Configure);

            app.OnExecute(() =>
            {
                (new RootCommand(app)).Run();
                return 0;
            });
        }

        private readonly CommandLineApplication _app;

        public RootCommand(CommandLineApplication app)
        {
            _app = app;
        }

        public void Run()
        {
            _app.ShowHelp();
        }
    }
}