start command to add a project
include the command plugin and argument processing but no data storage
This commit is contained in:
parent
81d8d06f78
commit
28e850532f
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from cliff.app import App
|
||||
|
@ -22,6 +23,23 @@ class Aeromancer(App):
|
|||
command_manager=CommandManager('aeromancer.cli'),
|
||||
)
|
||||
|
||||
def build_option_parser(self, description, version,
|
||||
argparse_kwargs=None):
|
||||
parser = super(Aeromancer, self).build_option_parser(
|
||||
description,
|
||||
version,
|
||||
argparse_kwargs,
|
||||
)
|
||||
default_repo_root = os.environ.get('AEROMANCER_REPOS', '~/repos')
|
||||
parser.add_argument(
|
||||
'--repo-root',
|
||||
default=os.path.expanduser(default_repo_root),
|
||||
help=('directory where repositories are checked out; '
|
||||
'set with AEROMANCER_REPOS environment variable; '
|
||||
'defaults to %(default)s'),
|
||||
)
|
||||
return parser
|
||||
|
||||
def configure_logging(self):
|
||||
super(Aeromancer, self).configure_logging()
|
||||
if self.options.verbose_level < 2:
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
from cliff.command import Command
|
||||
|
||||
|
||||
class Add(Command):
|
||||
"(Re)register a project to be scanned"
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(Add, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'project',
|
||||
nargs='+',
|
||||
default=[],
|
||||
help='project directory names under the project root, e.g., "stackforge/aeromancer"',
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
for project in parsed_args.project:
|
||||
project_path = os.path.join(self.app.options.repo_root, project)
|
||||
self.log.info('adding project %s from %s', project, project_path)
|
Loading…
Reference in New Issue