blob: 6621954fce7b7d0b73dd7f29c1be5fa4046345ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import sys
import shutil
from dots_manager.config import Environment, parse_arguments
from dots_manager.template import compile_dotfiles
from dots_manager.stow import apply_stow_operation_to_packages
def main():
args = parse_arguments()
env = Environment.from_argv(args)
if args.clean and not (
apply_stow_operation_to_packages(args.output, args.target, "--delete", env)
and (not args.output.exists() or shutil.rmtree(args.output) is None)
):
env.logger.error("could not clean up stowed dotfiles <_mood.sad>")
sys.exit(1)
if args.compile and not compile_dotfiles(args.source, args.output, env):
env.logger.error("could not compile dotfiles <_mood.sad>")
sys.exit(1)
if args.stow and not apply_stow_operation_to_packages(
args.output, args.target, "--no-folding", env
):
env.logger.error("could not stow dotfile packages <_mood.sad>")
sys.exit(1)
env.logger.info("done! <_mood.happy>")
sys.exit(0)
|