mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-16 18:30:17 +00:00
add ability to define the default profile using an environment variable
This commit is contained in:
13
README.md
13
README.md
@@ -200,6 +200,9 @@ For more options see `dotdrop.sh --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.
|
hostname of the host on which it runs.
|
||||||
|
|
||||||
|
The default profile used can be changed by defining
|
||||||
|
the `DOTDROP_PROFILE` environment variable.
|
||||||
|
|
||||||
## Install dotfiles
|
## Install dotfiles
|
||||||
|
|
||||||
Simply run
|
Simply run
|
||||||
@@ -207,8 +210,9 @@ Simply run
|
|||||||
$ dotdrop.sh install
|
$ dotdrop.sh install
|
||||||
```
|
```
|
||||||
|
|
||||||
Use the `--profile` switch to specify a profile if not using
|
Use the `--profile` switch to specify a different profile than
|
||||||
the host's hostname.
|
the host's hostname or define it through the `DOTDROP_PROFILE`
|
||||||
|
environment variable.
|
||||||
|
|
||||||
## Compare dotfiles
|
## Compare dotfiles
|
||||||
|
|
||||||
@@ -256,9 +260,12 @@ $ dotdrop.sh list
|
|||||||
```
|
```
|
||||||
|
|
||||||
Dotdrop allows to choose which profile to use
|
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).
|
else than the default (the hostname).
|
||||||
|
|
||||||
|
The default profile can be changed by defining the
|
||||||
|
`DOTDROP_PROFILE` environment variable.
|
||||||
|
|
||||||
## List dotfiles
|
## List dotfiles
|
||||||
|
|
||||||
The following command lists the different dotfiles
|
The following command lists the different dotfiles
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ from dotdrop.utils import *
|
|||||||
|
|
||||||
CUR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
CUR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
LOG = Logger()
|
LOG = Logger()
|
||||||
HOSTNAME = socket.gethostname()
|
ENV_PROFILE = 'DOTDROP_PROFILE'
|
||||||
|
PROFILE = socket.gethostname()
|
||||||
|
if ENV_PROFILE in os.environ:
|
||||||
|
PROFILE = os.environ[ENV_PROFILE]
|
||||||
TILD = '~'
|
TILD = '~'
|
||||||
TRANS_SUFFIX = 'trans'
|
TRANS_SUFFIX = 'trans'
|
||||||
|
|
||||||
@@ -64,7 +67,7 @@ Options:
|
|||||||
-v --version Show version.
|
-v --version Show version.
|
||||||
-h --help Show this screen.
|
-h --help Show this screen.
|
||||||
|
|
||||||
""".format(BANNER, HOSTNAME)
|
""".format(BANNER, PROFILE)
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
# entry point
|
# entry point
|
||||||
@@ -322,6 +325,7 @@ def main():
|
|||||||
"""entry point"""
|
"""entry point"""
|
||||||
ret = True
|
ret = True
|
||||||
args = docopt(USAGE, version=VERSION)
|
args = docopt(USAGE, version=VERSION)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
conf = Cfg(os.path.expanduser(args['--cfg']))
|
conf = Cfg(os.path.expanduser(args['--cfg']))
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user