CiscoDevNet / ncc

ncclient scripts and helpers
Other
67 stars 28 forks source link

Simplify path/subtree filter logic #3

Closed einarnn closed 7 years ago

einarnn commented 7 years ago

From aradford123:

I think there is an opportunity to simplify the logic around xpath/filters.

Both are None by default if there are no args passed. You check them inside get-running-config and get, so no need to call these two with one or the other?


if args.get_running:
# if args.xpath:
#     get_running_config(m, xpath=args.xpath)
# else:
#     get_running_config(m, filter=args.filter)
get_running_config(m, xpath=args.xpath, filter=args.filter)

elif args.get_oper:

if args.xpath:

#    get(m, xpath=args.xpath)
#else:
#    get(m, filter=args.filter)
get(m, filter=args.filter, xpath=args.xpath)
einarnn commented 7 years ago

Yep, sensible change.

einarnn commented 7 years ago

Addressed in #11 .