zabgrab.model.itemspec¶
Conversion between item specs and their command line form.
Forms accepted by --item:
12345: an item IDhost=demo1,name=Particles *: comma-separatedfield=valuepairs, with fieldsitemid,host,name,keyandtagParticles *: anything else without=is a name pattern
Values may contain commas (common in item keys such as net.if.in[eth0,bytes]);
only a comma followed by field= starts a new pair.
Functions
|
Write an item spec in its command line form. |
|
Parse the command line form of an item spec. |
- zabgrab.model.itemspec.parse_item_spec(text)[source]¶
Parse the command line form of an item spec.
- Parameters:
text (str) – An
--itemvalue (see the module docstring).- Returns:
ItemSpec – The item spec.
- Raises:
ValueError – With a message suitable for showing to the user.
- Return type:
- zabgrab.model.itemspec.format_item_spec(spec)[source]¶
Write an item spec in its command line form.
The inverse of
parse_item_spec().- Parameters:
spec (ItemSpec) – The item spec.
- Returns:
str – The
--itemvalue that givesspec.- Raises:
ValueError – If the spec’s host is a choice, which has no command line form.
- Return type: