1 module clid.attributes; 2 3 /** 4 * This attribute will mark a property as a command line argument. 5 */ 6 struct Parameter 7 { 8 /** A single character flag. */ 9 dchar shortName; 10 /** A multi-character flag. */ 11 string longName; 12 13 /** 14 * Params: 15 * longName = A larger string that will be used as a long flag. (e.g.: --flag) 16 * shortName = A single character that will be used as the short flag. (e.g.: -f) 17 */ 18 this(string longName, dchar shortName = ' ') 19 { 20 this.longName = longName; 21 this.shortName = shortName; 22 } 23 24 /** 25 * Checks if this parameter flag name equals a string. 26 * Params: 27 * arg = The argument to check against. 28 */ 29 bool equals(string arg) immutable 30 { 31 return arg.length == 1 ? shortName == arg[0] : longName == arg; 32 } 33 } 34 35 /** 36 * This attribute will give a description to an argument. 37 */ 38 struct Description 39 { 40 /** 41 * The description of the argument. 42 */ 43 string description; 44 45 /** 46 * A single word that describes the value of the option. 47 * E.g.: for an options --time, the optionType could be "secs". 48 * In the help file this would then be listed as: 49 * --time secs The time that has passen 50 */ 51 string optionType; 52 53 /** 54 * Params: 55 * description = The description to give to this argument. 56 * optionType = The optionType to give to this argument. 57 */ 58 this(string description, string optionType = "") 59 { 60 this.description = description; 61 this.optionType = optionType; 62 } 63 } 64 65 /** 66 * Marks that the given argument is required to be given. 67 */ 68 struct Required 69 { 70 71 }