mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-11 04:59:15 +00:00
adding command to list files for a specific profile
This commit is contained in:
@@ -33,6 +33,7 @@ Usage:
|
|||||||
dotdrop.py install [-fndvc <path>] [--profile=<profile>]
|
dotdrop.py install [-fndvc <path>] [--profile=<profile>]
|
||||||
dotdrop.py compare [-vc <path>] [--profile=<profile>] [--files=<files>]
|
dotdrop.py compare [-vc <path>] [--profile=<profile>] [--files=<files>]
|
||||||
dotdrop.py import [-ldc <path>] [--profile=<profile>] <paths>...
|
dotdrop.py import [-ldc <path>] [--profile=<profile>] <paths>...
|
||||||
|
dotdrop.py listfiles [-c <path>] [--profile=<profile>]
|
||||||
dotdrop.py list [-c <path>]
|
dotdrop.py list [-c <path>]
|
||||||
dotdrop.py --help
|
dotdrop.py --help
|
||||||
dotdrop.py --version
|
dotdrop.py --version
|
||||||
@@ -172,6 +173,18 @@ def list_profiles(conf):
|
|||||||
LOG.log('')
|
LOG.log('')
|
||||||
|
|
||||||
|
|
||||||
|
def list_files(opts, conf):
|
||||||
|
if not opts['profile'] in conf.get_profiles():
|
||||||
|
LOG.warn('unknown profile \"%s\"' % (opts['profile']))
|
||||||
|
return
|
||||||
|
LOG.log('Dotfile(s) for profile \"%s\":' % (opts['profile']))
|
||||||
|
for dotfile in conf.get_dotfiles(opts['profile']):
|
||||||
|
LOG.log('%s (file: \"%s\", link: %s)' % (dotfile.key, dotfile.src,
|
||||||
|
str(dotfile.link)))
|
||||||
|
LOG.sub('%s' % (dotfile.dst))
|
||||||
|
LOG.log('')
|
||||||
|
|
||||||
|
|
||||||
def header():
|
def header():
|
||||||
LOG.log(BANNER)
|
LOG.log(BANNER)
|
||||||
LOG.log("")
|
LOG.log("")
|
||||||
@@ -195,12 +208,19 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
if args['list']:
|
if args['list']:
|
||||||
|
# list existing profiles
|
||||||
list_profiles(conf)
|
list_profiles(conf)
|
||||||
|
|
||||||
|
elif args['listfiles']:
|
||||||
|
# list files for selected profile
|
||||||
|
list_files(opts, conf)
|
||||||
|
|
||||||
elif args['install']:
|
elif args['install']:
|
||||||
|
# install the dotfiles stored in dotdrop
|
||||||
ret = install(opts, conf)
|
ret = install(opts, conf)
|
||||||
|
|
||||||
elif args['compare']:
|
elif args['compare']:
|
||||||
|
# compare local dotfiles with dotfiles stored in dotdrop
|
||||||
tmp = utils.get_tmpdir()
|
tmp = utils.get_tmpdir()
|
||||||
if compare(opts, conf, tmp, args['--files']):
|
if compare(opts, conf, tmp, args['--files']):
|
||||||
LOG.raw('\ntemporary files available under %s' % (tmp))
|
LOG.raw('\ntemporary files available under %s' % (tmp))
|
||||||
@@ -208,6 +228,7 @@ if __name__ == '__main__':
|
|||||||
os.rmdir(tmp)
|
os.rmdir(tmp)
|
||||||
|
|
||||||
elif args['import']:
|
elif args['import']:
|
||||||
|
# import dotfile(s)
|
||||||
importer(opts, conf, args['<paths>'])
|
importer(opts, conf, args['<paths>'])
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
Reference in New Issue
Block a user