Merge pull request #2 from pdehaan/cli-tool

Add fftool/main.py
This commit is contained in:
Richard Pappalardo 2016-02-19 13:14:53 -08:00
Родитель 93525bab82 2d0745162f
Коммит 7650e949d5
1 изменённых файлов: 91 добавлений и 0 удалений

91
fftool/main.py Executable file
Просмотреть файл

@ -0,0 +1,91 @@
#!/usr/bin/env python
import argparse
CHANNELS = ['gr', 'beta', 'aurora', 'nightly', 'ALL']
DEFAULT_CHANNEL = 'nightly'
parser = argparse.ArgumentParser(prog='ff-tool')
subparsers = parser.add_subparsers(help='commands', dest='command')
"""
Global arguments...
"""
# parser.add_argument('--foo', action='store_true', help='foo help')
"""
ff-tool <download> specific arguments...
"""
download = subparsers.add_parser('download', help='<download> command help')
download.add_argument(
'-c',
'--channel',
choices=CHANNELS,
default=DEFAULT_CHANNEL,
type=str,
help='Download a specific Firefox channel via mozdownload.'
)
"""
ff-tool <install> specific arguments...
"""
install = subparsers.add_parser('install', help='<install> command help')
install.add_argument(
'-c',
'--channel',
choices=CHANNELS,
default=DEFAULT_CHANNEL,
type=str,
help='Install a specific Firefox channel.'
)
"""
ff-tool <profile> specific arguments...
"""
profile = subparsers.add_parser('profile', help='<profile> command help')
profile.add_argument(
'-c',
'--create',
type=str,
help='Create a new Firefox profile with the specified name.'
)
profile.add_argument(
'-d',
'--delete',
type=str,
help='Delete the specified Firefox profile.'
)
"""
ff-tool <uninstall> specific arguments...
"""
uninstall = subparsers.add_parser('uninstall', help='<uninstall> command help')
uninstall.add_argument(
'-c',
'--channel',
choices=CHANNELS,
default=DEFAULT_CHANNEL,
type=str,
help='Uninstall a specific Firefox channel.'
)
options = parser.parse_args()
if options.command == 'download':
print("Downloading Firefox... [channel: {0}]".format(options.channel))
elif options.command == 'install':
print("Installing Firefox... [channel: {0}]".format(options.channel))
elif options.command == 'profile':
if options.create:
print("Creating Firefox profile... [name: {0}]".format(options.create))
if options.delete:
print("Deleting Firefox profile... [name: {0}]".format(options.delete))
elif options.command == 'uninstall':
print("Uninstalling Firefox... [channel: {0}]".format(options.channel))
print(options)