1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 20:54:51 +00:00

add ability to define the default profile using an environment variable

This commit is contained in:
deadc0de6
2018-09-01 16:15:25 +02:00
parent 5c61a24304
commit 1c3e8de039
2 changed files with 16 additions and 5 deletions

View File

@@ -200,6 +200,9 @@ For more options see `dotdrop.sh --help`.
For easy deployment the default profile used by dotdrop reflects the
hostname of the host on which it runs.
The default profile used can be changed by defining
the `DOTDROP_PROFILE` environment variable.
## Install dotfiles
Simply run
@@ -207,8 +210,9 @@ Simply run
$ dotdrop.sh install
```
Use the `--profile` switch to specify a profile if not using
the host's hostname.
Use the `--profile` switch to specify a different profile than
the host's hostname or define it through the `DOTDROP_PROFILE`
environment variable.
## Compare dotfiles
@@ -256,9 +260,12 @@ $ dotdrop.sh list
```
Dotdrop allows to choose which profile to use
with the *--profile* switch if you use something
with the `--profile` switch if you use something
else than the default (the hostname).
The default profile can be changed by defining the
`DOTDROP_PROFILE` environment variable.
## List dotfiles
The following command lists the different dotfiles

View File

@@ -24,7 +24,10 @@ from dotdrop.utils import *
CUR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
LOG = Logger()
HOSTNAME = socket.gethostname()
ENV_PROFILE = 'DOTDROP_PROFILE'
PROFILE = socket.gethostname()
if ENV_PROFILE in os.environ:
PROFILE = os.environ[ENV_PROFILE]
TILD = '~'
TRANS_SUFFIX = 'trans'
@@ -64,7 +67,7 @@ Options:
-v --version Show version.
-h --help Show this screen.
""".format(BANNER, HOSTNAME)
""".format(BANNER, PROFILE)
###########################################################
# entry point
@@ -322,6 +325,7 @@ def main():
"""entry point"""
ret = True
args = docopt(USAGE, version=VERSION)
try:
conf = Cfg(os.path.expanduser(args['--cfg']))
except ValueError as e: