forked from utahta/pythonbrew
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
27 lines (24 loc) · 756 Bytes
/
__init__.py
File metadata and controls
27 lines (24 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
import os
from pythonbrew.basecommand import command_dict, load_all_commands
from pythonbrew.baseparser import parser
from pythonbrew.log import logger
from pythonbrew.define import PATH_HOME_ETC
from pythonbrew.util import makedirs
def init_home():
if not os.path.isdir(PATH_HOME_ETC):
makedirs(PATH_HOME_ETC)
def main():
options, args = parser.parse_args(sys.argv[1:])
if options.help and not args:
args = ['help']
if not args:
args = ['help'] # as default
init_home()
load_all_commands()
command = args[0].lower()
if command not in command_dict:
parser.error("Unknown command: `%s`" % command)
return
command = command_dict[command]
command.run(args[1:])