Navigation


Changeset 1494:ae76ea63ee12 in freeDiameter


Ignore:
Timestamp:
Mar 30, 2020, 2:46:31 PM (4 years ago)
Author:
Luke Mewburn <luke@mewburn.net>
Branch:
default
Phase:
public
Message:

csv_to_fd: improve comments and usage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • contrib/tools/csv_to_fd

    r1487 r1494  
    1111        AVP Name. String, validated as ALPHA *(ALPHA / DIGIT / "-")
    1212        per RFC 6733 section 3.2.
     13        May start with a DIGIT (e.g., "3GPP-IMSI").
    1314    - Code:
    1415        AVP Code. Integer, 0..4294967295.
     
    2122            - RFC 7155 section 4.1
    2223    - Must, May, ShouldNot, MustNot:
    23         Flags, possibly comma or space separated: M, V
     24        Flags, possibly comma or space separated: M, P, V
    2425
    2526- Comment row. First cell:
     
    183184
    184185class Processor(object):
    185     """Interface for processor of Avp"""
     186    """Interface for processor of Avp."""
    186187
    187188    __metaclass__ = abc.ABCMeta
     
    227228
    228229class DebugProcessor(Processor):
    229     """Display the CSV parsing"""
     230    """Display the CSV parsing."""
    230231
    231232    def next_file(self, filename):
     
    244245
    245246class NoopProcessor(Processor):
    246     """Validate the CSV; no other output"""
     247    """Validate the CSV; no other output."""
    247248
    248249    def next_file(self, filename):
     
    260261
    261262class FdcProcessor(Processor):
    262     """Generate freeDiameter C code
     263    """Generate freeDiameter C code.
    263264
    264265    Comment cells are parsed as:
     
    375376
    376377class JsonProcessor(Processor):
    377     """Generate freeDiameter JSON object
     378    """Generate freeDiameter JSON object.
    378379    """
    379380
     
    461462    # Parse options
    462463    parser = MyParser(
     464        usage='%prog [-h] [-p PROCESSOR] FILE ...',
    463465        description="""\
    464 Convert CSV files containing RADIUS or Diameter AVP tables
     466Convert CSV files FILE ... containing RADIUS or Diameter AVP tables
    465467into various formats using the specified processor PROCESSOR.
    466468""")
     
    473475    (opts, args) = parser.parse_args()
    474476    if len(args) < 1:
    475         parser.error('Incorrect number of arguments')
     477        parser.error('Incorrect number of arguments. Use -h for help.')
    476478
    477479    # Find processor
     
    479481        avpproc = processors[opts.processor]()
    480482    except KeyError as e:
    481         parser.error('Unknown processor "{}"'.format(opts.processor))
     483        parser.error('Unknown processor "{}".'.format(opts.processor))
    482484
    483485    # dict of [vendor][code] : Avp
Note: See TracChangeset for help on using the changeset viewer.