1   package com.lexicalscope.jewel.cli.examples;
2   
3   import java.io.File;
4   import java.util.List;
5   
6   import com.lexicalscope.jewel.cli.CommandLineInterface;
7   import com.lexicalscope.jewel.cli.Option;
8   import com.lexicalscope.jewel.cli.Unparsed;
9   
10  @CommandLineInterface(application = "rm") public class RmClassExample
11  {
12      private boolean recursive;
13      private boolean verbose;
14      private boolean version;
15      private List<File> files;
16      private boolean force;
17      private boolean interactive;
18      private boolean help;
19      private boolean directory;
20  
21      @Option(shortName = "d", longName = "directory", description = "unlink FILE, even if it is a non-empty directory (super-user only)") void setRemoveNonEmptyDirectory(
22              final boolean directory) {
23          this.directory = directory;
24      }
25  
26      public boolean isRemoveNonEmptyDirectory()
27      {
28          return directory;
29      }
30  
31      @Option(shortName = "f", description = "ignore nonexistent files, never prompt") void setForce(final boolean force) {
32          this.force = force;
33      }
34  
35      public boolean isForce() {
36          return force;
37      }
38  
39      @Option(shortName = "i", description = "prompt before any removal") void setInteractive(final boolean interactive) {
40          this.interactive = interactive;
41      }
42  
43      public boolean isInteractive() {
44          return interactive;
45      }
46  
47      @Option(shortName = { "r", "R" }, description = "remove the contents of directories recursively") void setRecursive(
48              final boolean recursive) {
49          this.recursive = recursive;
50      }
51  
52      public boolean isRecursive() {
53          return recursive;
54      }
55  
56      @Option(description = "display this help and exit") void setHelp(final boolean help) {
57          this.help = help;
58      }
59  
60      public boolean isHelp() {
61          return help;
62      }
63  
64      @Option(description = "output version information and exit") void setVersion(final boolean version) {
65          this.version = version;
66      }
67  
68      public boolean isVersion() {
69          return version;
70      }
71  
72      @Option(shortName = "v", description = "explain what is being done") void setVerbose(final boolean verbose) {
73          this.verbose = verbose;
74      }
75  
76      public boolean isVerbose() {
77          return verbose;
78      }
79  
80      @Unparsed(name = "FILE") void setFiles(final List<File> files) {
81          this.files = files;
82      }
83  
84      public List<File> getFiles() {
85          return files;
86      }
87  }