<s> """<STR_LIT>""" <EOL> import argparse <EOL> from pysteam . steam import get_steam , Steam <EOL> import tasks <EOL> from ice import decorators <EOL> from ice import debug <EOL> from ice import settings <EOL> from ice . logs import logger <EOL> from ice . filesystem import RealFilesystem <EOL> from ice . tasks import TaskEngine <EOL> def handle_exception ( e , fatal ) : <EOL> if fatal : <EOL> logger . exception ( "<STR_LIT>" ) <EOL> else : <EOL> logger . error ( e . message ) <EOL> class CommandLineRunner ( object ) : <EOL> def __init__ ( self , steam = None , filesystem = None ) : <EOL> self . steam = steam <EOL> self . filesystem = RealFilesystem ( ) if filesystem is None else filesystem <EOL> def get_command_line_args ( self , argv ) : <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( '<STR_LIT>' , type = bool , nargs = '<STR_LIT:?>' , help = "<STR_LIT>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = '<STR_LIT:store_true>' , help = "<STR_LIT>" ) <EOL> parser . add_argument ( '<STR_LIT>' , action = '<STR_LIT:store_true>' , help = "<STR_LIT>" ) <EOL> parser . add_argument ( '<STR_LIT:-c>' , '<STR_LIT>' , type = str , default = None ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , type = str , default = None ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , type = str , default = None ) <EOL> parser . add_argument ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' ) <EOL> return parser . parse_args ( argv ) <EOL> def should_use_user_override ( self , override ) : <EOL> if override is None : <EOL> return False <EOL> if override == "<STR_LIT>" : <EOL> return False <EOL> if not self . filesystem . path_exists ( override ) : <EOL> logger . warning ( "<STR_LIT>" ) <EOL> return False <EOL> return False <EOL> def get_steam ( self , config ) : <EOL> override = config . userdata_directory <EOL> if self . should_use_user_override ( override ) : <EOL> return Steam ( override ) <EOL> if self . steam is not None : <EOL> return self . steam <EOL> return get_steam ( ) <EOL> @ decorators . catch_exceptions ( handle_exception ) <EOL> def run ( self , argv ) : <EOL> opts = self . get_command_line_args ( argv [ <NUM_LIT:1> : ] ) <EOL> if opts . pdebug is True : <EOL> debug . paste_debug_logs ( ) <EOL> return <EOL> task_coordinator = tasks . TaskCoordinator ( self . filesystem ) <EOL> app_settings = settings . load_app_settings ( self . filesystem , file_overrides = { <EOL> '<STR_LIT>' : opts . config , <EOL> '<STR_LIT>' : opts . consoles , <EOL> '<STR_LIT>' : opts . emulators , <EOL> } ) <EOL> engine = TaskEngine ( <EOL> self . get_steam ( app_settings . config ) , <EOL> ) <EOL> tasks_to_run = task_coordinator . tasks_for_options ( <EOL> launch_steam = opts . launch_steam , <EOL> skip_steam_check = opts . skip_steam_check , <EOL> ) <EOL> engine . run ( <EOL> tasks = tasks_to_run , <EOL> app_settings = app_settings , <EOL> dry_run = opts . dry_run <EOL> ) </s>
