def main(args):
    '''Return the fully qualified reference designator list for all instruments
    if no partial or fully-qualified reference_designator is specified.  Specify
    the -s or --streams option to include metadata for all streams produced by the
    instrument(s)'''
    
    status = 0
    
    base_url = args.base_url
    if not base_url:
        if args.verbose:
            sys.stderr.write('No uframe_base specified.  Checking UFRAME_BASE_URL environment variable\n')
            
        base_url = os.getenv('UFRAME_BASE_URL')
        
    if not base_url:
        sys.stderr.write('No UFrame instance specified')
        sys.stderr.flush()
        return 1
    
    # Create a UFrame instance   
    if args.verbose:
        sys.stderr.write('Creating UFrame API instance\n')
    
    uframe = UFrame(base_url=base_url,
        timeout=args.timeout,
        validate=args.validate_uframe)
    
    # Fetch the table of contents from UFrame
    if args.verbose:
        t0 = datetime.datetime.utcnow()
        sys.stderr.write('Fetching and creating UFrame table of contents...')
        
    uframe.fetch_toc()
    
    if args.verbose:
        t1 = datetime.datetime.utcnow()
        dt = t1 - t0
        sys.stderr.write('Complete ({:d} seconds)\n'.format(dt.seconds))
    
    if args.reference_designator:
        if args.streams:
            instruments = uframe.instrument_to_streams(args.reference_designator)
        else:
            instruments = uframe.search_instruments(args.reference_designator)
    else:
        instruments = uframe.instruments
        
    if not instruments:
        sys.stderr.write('{:s}: No instrument matches found\n'.format(args.reference_designator))
        return status
        
    if args.json:
        sys.stdout.write(json.dumps(instruments))
    elif args.streams:
        csv_writer = csv.writer(sys.stdout)
        if args.metadata:
            cols = instruments[0].keys()
            cols.sort()
        else:
            cols = ['reference_designator',
                    'stream']
        csv_writer.writerow(cols)
        for instrument in instruments:
            csv_writer.writerow([instrument[k] for k in cols])
    else:
        for instrument in instruments:
            sys.stdout.write('{:s}\n'.format(instrument))
    
    return status