mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-05 23:09:32 +01:00
28 lines
765 B
Python
28 lines
765 B
Python
"""
|
|
main entry point / argument parsing for dvc
|
|
"""
|
|
|
|
import sys
|
|
from dvc.settings import Settings
|
|
from dvc.logger import Logger
|
|
from dvc.config import ConfigError
|
|
|
|
def main():
|
|
try:
|
|
settings = Settings(sys.argv[1:])
|
|
instance = settings._parsed_args.func(settings)
|
|
except Exception as e:
|
|
# In case we didn't even manage to parse options
|
|
exc_info = '-v' in sys.argv or '--verbose' in sys.argv
|
|
Logger.error("Settings error: {}".format(e), exc_info=exc_info)
|
|
return 255
|
|
|
|
try:
|
|
ret = instance.run()
|
|
except Exception as e:
|
|
exc_info = settings.parsed_args.verbose
|
|
Logger.error("{} error: {}".format(instance.__class__.__name__, e), exc_info=exc_info)
|
|
return 254
|
|
|
|
return ret
|