view profilemanager/main.py @ 15:543d08958b67

actually sample 8 random lowercase letters and numbers for the profile hash
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 06 May 2010 11:06:59 -0700
parents c77e9bef78d6
children 49d523a33c89
line wrap: on
line source

#!/usr/bin/env python

import os
import sys

from manager import ProfileManager
from command import CommandParser

def create_profilemanager(parser, options):
    """create the profile manager from parsed arguments"""
    if options.config is None:
        # XXX unix-specific
        options.config = os.path.join(os.environ['HOME'], '.mozilla/firefox/profiles.ini')
    if not os.path.exists(options.config):
        parser.error('%s does not exist' % options.config)
    return ProfileManager(options.config)

def main(args=sys.argv[1:]):

    # global option parsing
    commands = [ ProfileManager.backup,
                 ProfileManager.backups,
                 ProfileManager.clone,
                 ProfileManager.list,
#                 ProfileManager.merge,
                 ProfileManager.new,
                 ProfileManager.restore,
                 ]
    parser = CommandParser(commands, setup=create_profilemanager)
    parser.add_option('-c', '--config', dest='config',
                      help="specify a profile.ini [default: $HOME/.mozilla/firefox/profiles.ini]")
    parser.invoke(args)

if __name__ == '__main__':
    main()