mirror of
https://github.com/gryf/slack-backup.git
synced 2025-12-17 11:30:25 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| feb773956c | |||
| 3f95986981 |
2
setup.py
2
setup.py
@@ -10,7 +10,7 @@ except ImportError:
|
|||||||
|
|
||||||
setup(name="slack-backup",
|
setup(name="slack-backup",
|
||||||
packages=["slack_backup"],
|
packages=["slack_backup"],
|
||||||
version="0.4.1",
|
version="0.4.3",
|
||||||
description="Make copy of slack converstaions",
|
description="Make copy of slack converstaions",
|
||||||
author="Roman Dobosz",
|
author="Roman Dobosz",
|
||||||
author_email="gryf73@gmail.com",
|
author_email="gryf73@gmail.com",
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class Config(object):
|
|||||||
path = args.config
|
path = args.config
|
||||||
|
|
||||||
locations = [path,
|
locations = [path,
|
||||||
'./slack-backup.conf',
|
'./slack-backup.ini',
|
||||||
os.path.expandvars('$XDG_CONFIG_HOME/slack-backup.ini'),
|
os.path.expandvars('$XDG_CONFIG_HOME/slack-backup.ini'),
|
||||||
os.path.expandvars('$HOME/.config/slack-backup.ini')]
|
os.path.expandvars('$HOME/.config/slack-backup.ini')]
|
||||||
|
|
||||||
@@ -83,19 +83,25 @@ class Config(object):
|
|||||||
val = self.cp.get(section, option, fallback='[]')
|
val = self.cp.get(section, option, fallback='[]')
|
||||||
val = json.loads(val)
|
val = json.loads(val)
|
||||||
else:
|
else:
|
||||||
val = self.cp.get(section, option, fallback='')
|
val = self.cp.get(section, option, fallback=None)
|
||||||
|
|
||||||
self._options[option] = val
|
self._options[option] = val
|
||||||
|
|
||||||
def update_args(self, args):
|
def update_args(self, args):
|
||||||
|
if 'parser' not in args:
|
||||||
|
# it doesn't make sense to update args, since no action was
|
||||||
|
# choosen
|
||||||
|
return
|
||||||
|
|
||||||
# special case, re-set information for verbose/quiet options
|
# special case, re-set information for verbose/quiet options
|
||||||
if args.verbose is not None and self._options['quiet'] is not None:
|
if 'verbose' in args and args.verbose is not None:
|
||||||
self._options['quiet'] = 0
|
|
||||||
self._options['verbose'] = args.verbose
|
self._options['verbose'] = args.verbose
|
||||||
if args.quiet is not None and self._options['verbose'] is not None:
|
if self._options['quiet'] is not None:
|
||||||
self._options['verbose'] = 0
|
self._options['quiet'] = 0
|
||||||
|
if 'quiet' in args and args.quiet is not None:
|
||||||
self._options['quiet'] = args.quiet
|
self._options['quiet'] = args.quiet
|
||||||
|
if self._options['verbose'] is not None:
|
||||||
|
self._options['verbose'] = 0
|
||||||
|
|
||||||
for sec_id in (args.parser, 'common'):
|
for sec_id in (args.parser, 'common'):
|
||||||
for option in self.sections[sec_id]:
|
for option in self.sections[sec_id]:
|
||||||
|
|||||||
@@ -51,13 +51,6 @@ class TestConfig(unittest.TestCase):
|
|||||||
args.config = None
|
args.config = None
|
||||||
args.parser = 'fetch'
|
args.parser = 'fetch'
|
||||||
args.verbose = 2
|
args.verbose = 2
|
||||||
args.quiet = None
|
|
||||||
args.channels = None
|
|
||||||
args.database = None
|
|
||||||
args.user = None
|
|
||||||
args.password = None
|
|
||||||
args.team = None
|
|
||||||
args.token = None
|
|
||||||
|
|
||||||
conf = config.Config()
|
conf = config.Config()
|
||||||
conf.update(args)
|
conf.update(args)
|
||||||
@@ -66,7 +59,7 @@ class TestConfig(unittest.TestCase):
|
|||||||
'verbose': 2,
|
'verbose': 2,
|
||||||
'quiet': 0,
|
'quiet': 0,
|
||||||
'channels': [],
|
'channels': [],
|
||||||
'database': '',
|
'database': None,
|
||||||
'user': None,
|
'user': None,
|
||||||
'password': None,
|
'password': None,
|
||||||
'team': None,
|
'team': None,
|
||||||
|
|||||||
Reference in New Issue
Block a user