Changeset 1332 for pykota/trunk/bin/pkprinters
- Timestamp:
- 02/04/04 14:24:41 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkprinters
r1331 r1332 24 24 # 25 25 # $Log$ 26 # Revision 1.3 2004/02/04 13:24:41 jalet 27 # pkprinters can now remove printers from printers groups. 28 # 26 29 # Revision 1.2 2004/02/04 12:52:37 jalet 27 30 # pkprinters' help … … 62 65 Floating point and negative values are allowed. 63 66 64 -g | --groups pg1[,pg2...] Adds the printer(s) to the printer groups65 pg1, pg2, etc... which must already exist.67 -g | --groups pg1[,pg2...] Adds or Remove the printer(s) to the printer 68 groups pg1, pg2, etc... which must already exist. 66 69 A printer group is just like a normal printer, 67 70 only that it is usually unknown from the printing … … 73 76 is done on a printer and on all the printer groups 74 77 it belongs to. 78 If the --remove option below is not used, the 79 default action is to add printers to the specified 80 printer groups. 81 82 -r | --remove In combination with the --groups option above, 83 remove printers from the specified printers groups. 75 84 76 85 printer1 through printerN can contain wildcards if the --add option … … 96 105 This will put all printers which name matches "hp*" into printers groups 97 106 Laser and HP, which MUST already exist. 107 108 $ pkprinters --groups LexMark --remove hp2200 109 110 This will remove the hp2200 printer from the LexMark printer group. 98 111 99 112 This program is free software; you can redistribute it and/or modify … … 159 172 if options["groups"] : 160 173 for pgroup in printersgroups : 161 pgroup.addPrinterToGroup(printer) 174 if options["remove"] : 175 pgroup.delPrinterFromGroup(printer) 176 else : 177 pgroup.addPrinterToGroup(printer) 162 178 163 179 if __name__ == "__main__" : 164 180 retcode = 0 165 181 try : 166 short_options = "hvac:dg: "167 long_options = ["help", "version", "add", "charge=", "delete", "groups=" ]182 short_options = "hvac:dg:r" 183 long_options = ["help", "version", "add", "charge=", "delete", "groups=", "remove"] 168 184 169 185 # Initializes the command line tool … … 180 196 options["delete"] = options["d"] or options["delete"] 181 197 options["groups"] = options["g"] or options["groups"] 198 options["remove"] = options["r"] or options["remove"] 182 199 183 200 if options["help"] : … … 185 202 elif options["version"] : 186 203 manager.display_version_and_quit() 187 elif options["delete"] and (options["add"] or options["groups"] or options["charge"] ) :204 elif options["delete"] and (options["add"] or options["groups"] or options["charge"] or options["remove"]) : 188 205 raise PyKotaToolError, _("incompatible options, see help.") 206 elif options["remove"] and not options["groups"] : 207 raise PyKotaToolError, _("You have to pass printer groups names on the command line") 189 208 elif not args : 190 209 raise PyKotaToolError, _("You have to pass printer names on the command line")