shell-scripts/mountain/mountain-handle

24 lines
477 B
Python
Executable file

#!/usr/bin/python
from configparser import ConfigParser
from os import environ
from os.path import expanduser
from sys import argv
if len(argv) == 1:
exit(1)
config = ConfigParser()
CONFIG_PATH = expanduser("~/.config/mountain.ini")
config.read(CONFIG_PATH)
sections = config.sections()
name = argv[1]
if name not in sections:
exit(2)
if config.has_option(name, "alias"):
name = config[name]["alias"]
dev = config[name]["dev"]
dir = config[name]["dir"]
print(dev, dir)