1 package hu.user.mediacube.integration.safedelete;
3 import lombok.extern.log4j.Log4j2;
4 import org.apache.commons.cli.CommandLine;
5 import org.apache.commons.cli.CommandLineParser;
6 import org.apache.commons.cli.DefaultParser;
7 import org.apache.commons.cli.Options;
8 import org.mybatis.spring.annotation.MapperScan;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.boot.CommandLineRunner;
11 import org.springframework.boot.SpringApplication;
12 import org.springframework.boot.autoconfigure.SpringBootApplication;
15 @SpringBootApplication()
16 @MapperScan({"hu.user.mediacube.rdb", "hu.user.mediacube.integration.safedelete.db"})
17 public class SafeDeleteMainEntry implements CommandLineRunner {
19 SafeDeleteCommand safeDeleteCommand;
21 public static void main(String[] args) {
22 SpringApplication.run(SafeDeleteMainEntry.class, args);
26 public void run(String... args) throws Exception {
27 Options options = new Options();
28 options.addRequiredOption("d", "directory", true, "source directory");
29 options.addOption("f", "force-delete", false, "force delete archived");
31 CommandLineParser parser = new DefaultParser();
32 CommandLine cmd = null;
35 cmd = parser.parse(options, args);
36 safeDeleteCommand.processDirectory(cmd.getOptionValue("d"), cmd.hasOption("f"));
37 } catch (Exception e) {
38 log.error(e.getMessage());
39 log.info("Usage: mc-safe-delete -d 'directory path' -f true/false");
41 //if (cmd.hasOption("d")