2019-06-07 02:55:59 +00:00
|
|
|
import sys
|
|
|
|
from pathlib import Path
|
2019-06-07 03:13:43 +00:00
|
|
|
|
2019-06-07 02:55:59 +00:00
|
|
|
from .error import InterpreterError
|
|
|
|
|
|
|
|
def load_file_path(arg: str) -> Path:
|
|
|
|
"""load given argument."""
|
|
|
|
|
|
|
|
try:
|
|
|
|
index = int(arg.split(':')[1])
|
|
|
|
except ValueError:
|
|
|
|
raise InterpreterError('Invalid argument index')
|
|
|
|
except IndexError:
|
|
|
|
return Path(arg).resolve()
|
|
|
|
|
|
|
|
return Path(sys.argv[2 + index])
|