Gitlab Community Edition Instance

Skip to content
Snippets Groups Projects

Alternative command registration mechanism

Closed rforkel requested to merge command-registration into master
9 files
+ 292
277
Compare changes
  • Side-by-side
  • Inline
Files
9
#: Commands to load automatically. The module pycdstar3.cli.NAME must have register(subparsers) defined.
BUILDIN_COMMANDS = ["init", "put", "get", "acl"]
from os.path import dirname, basename, isfile, join
import glob
# To make it possible to find all available commands by iterating over subclasses of Command,
# we must make sure all modules with such subclasses are imported. With the "hack" below, this
# can be achieved with "from phyltr.commands import *"
modules = glob.glob(join(dirname(__file__), "*.py"))
__all__ = [
basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py')]
Loading