shell-scripts/mountain/mountain-handle

25 lines
477 B
Text
Raw Permalink Normal View History

2023-07-06 11:07:16 -04:00
#!/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)