in asfpy/clitools.py [0:0]
def ldapsearch_cliargs(ldap_base, ldap_scope, ldap_query, ldap_attrs, ldap_exec):
"""Constructs a list of command line arguments for asfldapsearch"""
cliargs = [
"/usr/bin/asfldapsearch" if ldap_exec is None else ldap_exec, # Executable
"-x", # Simple bind
"-LLL", # be very concise
"-b", # Set base of search operations to...
ldap_base,
"-s", # Limit scope to...
ldap_scope,
"-o",
"ldif-wrap=no", # Don't wrap long lines
ldap_query, # This is our query
]
# Check if attrs is a list or a single string, adjust cliargs accordingly...
if isinstance(ldap_attrs, list) or isinstance(ldap_attrs, tuple):
cliargs.extend(ldap_attrs)
elif isinstance(ldap_attrs, str):
cliargs.append(ldap_attrs)
# Return the cli arg list
return cliargs