Update config handlnig
This commit is contained in:
parent
1adecdde2d
commit
cad695c676
@ -1,19 +1,15 @@
|
|||||||
# external imports
|
def process_config(config, arg, args, flags):
|
||||||
from chainsyncer.cli import SyncFlag
|
|
||||||
|
|
||||||
|
|
||||||
def process_config(config, args, flags):
|
|
||||||
args_override = {}
|
args_override = {}
|
||||||
|
|
||||||
args_override['SYNCER_BACKEND'] = getattr(args, 'backend')
|
args_override['SYNCER_BACKEND'] = getattr(args, 'backend')
|
||||||
|
|
||||||
if flags & SyncFlag.RANGE:
|
if arg.match('range', flags):
|
||||||
args_override['SYNCER_OFFSET'] = getattr(args, 'offset')
|
args_override['SYNCER_OFFSET'] = getattr(args, 'offset')
|
||||||
args_override['SYNCER_LIMIT'] = getattr(args, 'until')
|
args_override['SYNCER_LIMIT'] = getattr(args, 'until')
|
||||||
|
|
||||||
config.dict_override(args_override, 'local cli args')
|
config.dict_override(args_override, 'local cli args')
|
||||||
|
|
||||||
if flags & SyncFlag.HEAD:
|
if arg.match('head', flags):
|
||||||
config.add(getattr(args, 'keep_alive'), '_KEEP_ALIVE')
|
config.add(getattr(args, 'keep_alive'), '_KEEP_ALIVE')
|
||||||
config.add(getattr(args, 'head'), '_HEAD')
|
config.add(getattr(args, 'head'), '_HEAD')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user