params.py 393 B

1234567891011121314151617181920
  1. import sys
  2. SYS_ARGS = {'context':''}
  3. if len(sys.argv) > 1:
  4. N = len(sys.argv)
  5. for i in range(1,N):
  6. value = None
  7. if sys.argv[i].startswith('--'):
  8. key = sys.argv[i][2:] #.replace('-','')
  9. SYS_ARGS[key] = 1
  10. if i + 1 < N:
  11. value = sys.argv[i + 1] = sys.argv[i+1].strip()
  12. if key and value and not value.startswith('--'):
  13. SYS_ARGS[key] = value
  14. i += 2