Project

General

Profile

« Previous | Next » 

Revision 3923

join: Use opts.env_usage() for usage message

View differences:

join
16 16
import util
17 17

  
18 18
def main():
19
    only_one = opts.env_flag('only_one')
19
    env_names = []
20
    def usage_err():
21
        raise SystemExit('Usage: '+opts.env_usage(env_names, True)+' '
22
            +sys.argv[0]+' <map_0 map_1 [| '+sys.argv[0]+' map_2]... >out_map')
23
    
24
    only_one = opts.env_flag('only_one', False, env_names)
25
    # Turns off "No input mapping" errors
26
    quiet = opts.env_flag('quiet', False, env_names)
20 27
    try: _prog_name, map_1_path = sys.argv
21
    except ValueError:
22
        raise SystemExit('Usage: env [only_one=1] '+sys.argv[0]
23
            +' <map_0 map_1 [| '+sys.argv[0]+' map_2]... >joined_map')
28
    except ValueError: usage_err()
24 29
    
25 30
    # Get map 1
26 31
    map_1 = {}
......
82 87
                msg += ' join mapping for '+out_orig
83 88
                set_error(msg)
84 89
        elif row[2] == '': # also no comment explaining why no input mapping
85
            set_error('No input mapping for '+row[0])
90
            if not quiet: set_error('No input mapping for '+row[0])
86 91
        
87 92
        if not row_written: writer.writerow(row)
88 93

  

Also available in: Unified diff