<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_command(all_pkg, hook):
 """ Collect the command-line interface names by querying ``hook`` in ``all_pkg`` Parameters all_pkg: list list of package files hook: str A variable where the command is stored. ``__cli__`` by default. Returns ------- list """

    ret = []
    for r in all_pkg:
        module = importlib.import_module(__name__ + '.' + r.lower())
        ret.append(getattr(module, hook))
    return ret