25 lines
477 B
Text
25 lines
477 B
Text
|
#!/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)
|