1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-12 04:49:00 +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 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 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 ## Install dotfiles

View File

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