mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 20:54:51 +00:00
56 lines
976 B
Python
Executable File
56 lines
976 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
author: deadc0de6 (https://github.com/deadc0de6)
|
|
Copyright (c) 2017, deadc0de6
|
|
|
|
transform all short dotfile keys
|
|
from the short format to the long
|
|
format
|
|
|
|
For example ~/.config/awesome/rc.lua
|
|
short format: f_rc.lua
|
|
long format: f_config_awesome_rc.lua
|
|
|
|
You need to have dotdrop installed for this script
|
|
to work (either with setup.py or pypi).
|
|
"""
|
|
|
|
from docopt import docopt
|
|
import sys
|
|
import os
|
|
from dotdrop.config import Cfg
|
|
|
|
|
|
USAGE = """
|
|
short-to-long-key.py
|
|
|
|
Usage:
|
|
short-to-long-key.py <config.yaml>
|
|
short-to-long-key.py --help
|
|
|
|
Options:
|
|
-h --help Show this screen.
|
|
|
|
"""
|
|
|
|
|
|
def main():
|
|
args = docopt(USAGE)
|
|
path = os.path.expanduser(args['<config.yaml>'])
|
|
|
|
try:
|
|
|
|
conf = Cfg(path)
|
|
except ValueError as e:
|
|
print('error: {}'.format(str(e)))
|
|
return False
|
|
|
|
conf.short_to_long()
|
|
print(conf.dump())
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if main():
|
|
sys.exit(0)
|
|
sys.exit(1)
|