1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-25 17:38:44 -05:00
aprsd/utils.py
Walter A. Boring IV 8b61116fce Added argparse for cli options
This patch adds the argparser to collect the user/callsign
from the command line, so it doesn't have to be hard coded.

It can be passed on the command line or set
in an environment var
python aprsd.py --user KCAMEL1

or

export APRS_USER=KCAMEL1
python aprsd.py
2018-11-21 12:55:14 -08:00

17 lines
370 B
Python

"""Utilities and helper functions."""
import os
import pprint
import sys
def env(*vars, **kwargs):
"""This returns the first environment variable set.
if none are non-empty, defaults to '' or keyword arg default
"""
for v in vars:
value = os.environ.get(v, None)
if value:
return value
return kwargs.get('default', '')