1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-05 00:59:42 +00:00

give ability to specify the config file using an environment variable DOTDROP_CONFIG

This commit is contained in:
deadc0de6
2019-03-01 20:04:12 +01:00
parent d59db1f6db
commit 5cd2616b17
2 changed files with 14 additions and 5 deletions

View File

@@ -192,7 +192,11 @@ For more options see `dotdrop --help`.
For easy deployment the default profile used by dotdrop reflects the
hostname of the host on which it runs. It can be changed either with the
`--profile` switch or by defining the `DOTDROP_PROFILE` environment variable.
`-p --profile` switch or by defining the `DOTDROP_PROFILE` environment variable.
The config file is per default `config.yaml` and can be changed either
using the `-c --cfg` cli switch or by defining the `DOTDROP_CONFIG` environment
variable.
## Install dotfiles

View File

@@ -15,13 +15,18 @@ from dotdrop.linktypes import LinkTypes
from dotdrop.logger import Logger
from dotdrop.config import Cfg
ENV_PROFILE = 'DOTDROP_PROFILE'
ENV_CONFIG = 'DOTDROP_CONFIG'
ENV_NOBANNER = 'DOTDROP_NOBANNER'
PROFILE = socket.gethostname()
ENV_PROFILE = 'DOTDROP_PROFILE'
ENV_NOBANNER = 'DOTDROP_NOBANNER'
if ENV_PROFILE in os.environ:
PROFILE = os.environ[ENV_PROFILE]
CONFIG = 'config.yaml'
if ENV_CONFIG in os.environ:
CONFIG = os.environ[ENV_CONFIG]
BANNER = """ _ _ _
__| | ___ | |_ __| |_ __ ___ _ __
/ _` |/ _ \| __/ _` | '__/ _ \| '_ |
@@ -46,7 +51,7 @@ Usage:
Options:
-p --profile=<profile> Specify the profile to use [default: {}].
-c --cfg=<path> Path to the config [default: config.yaml].
-c --cfg=<path> Path to the config [default: {}].
-C --file=<path> Path of dotfile to compare.
-i --ignore=<pattern> Pattern to ignore.
-o --dopts=<opts> Diff options [default: ].
@@ -64,7 +69,7 @@ Options:
-v --version Show version.
-h --help Show this screen.
""".format(BANNER, PROFILE)
""".format(BANNER, PROFILE, CONFIG)
class AttrMonitor: