Example #1
0
 def test_un_camel_case(self):
     self.assertEqual('jira', base.un_camel_case('JIRA'))
     self.assertEqual('jira_tool', base.un_camel_case('JIRATool'))
     self.assertEqual('jira_tool', base.un_camel_case('jira_tool'))
     self.assertEqual('jira_tool', base.un_camel_case('jira tool'))
     self.assertEqual('jira_tool', base.un_camel_case('Jira tool'))
     self.assertEqual('jira_tool', base.un_camel_case(' Jira tool'))
     self.assertEqual('status_csv', base.un_camel_case(' StatusCSV'))
Example #2
0
 def test_un_camel_case(self):
     self.assertEqual('jira', base.un_camel_case('JIRA'))
     self.assertEqual('jira_tool', base.un_camel_case('JIRATool'))
     self.assertEqual('jira_tool', base.un_camel_case('jira_tool'))
     self.assertEqual('jira_tool', base.un_camel_case('jira tool'))
     self.assertEqual('jira_tool', base.un_camel_case('Jira tool'))
     self.assertEqual('jira_tool', base.un_camel_case(' Jira tool'))
     self.assertEqual('status_csv', base.un_camel_case(' StatusCSV'))
Example #3
0
        this = base.get_program_name()
        if (len(args) == 1) and (args[0] in ACTIONS):
            action = args[0]
            print('Usage for %s %s' % (this, action))
            ACTIONS[action](workspace=None)(['--help'])
        else:
            print(USAGE % {'this': this})
            FLAGS.print_usage()


# --------------------------------------------------------------------------------------------------


# Map: action-name (dash-separated) -> CLI Action class :
ACTIONS = dict(
    map(lambda cls: (base.un_camel_case(cls.__name__, separator='-'), cls),
        Action.__subclasses__()
        + [Run, Test, Checkstyle, Scalastyle, Lint, GeneratePom, Help])
)


class FijiBuildTool(cli.Action):
    """Command-line tool dispatcher for fiji-build."""

    def __init__(self, **kwargs):
        super().__init__(
            help_flag=cli.HelpFlag.ADD_NO_HANDLE,
            **kwargs
        )

    def register_flags(self):
Example #4
0
        this = base.get_program_name()
        if (len(args) == 1) and (args[0] in ACTIONS):
            action = args[0]
            print('Usage for %s %s' % (this, action))
            ACTIONS[action](workspace=None)(['--help'])
        else:
            print(USAGE % {'this': this})
            FLAGS.print_usage()


# --------------------------------------------------------------------------------------------------

# Map: action-name (dash-separated) -> CLI Action class :
ACTIONS = dict(
    map(
        lambda cls: (base.un_camel_case(cls.__name__, separator='-'), cls),
        Action.__subclasses__() +
        [Run, Test, Checkstyle, Scalastyle, Lint, GeneratePom, Help]))


class KijiBuildTool(cli.Action):
    """Command-line tool dispatcher for kiji-build."""
    def __init__(self, **kwargs):
        super().__init__(help_flag=cli.HelpFlag.ADD_NO_HANDLE, **kwargs)

    def register_flags(self):
        self.flags.add_string(
            name='do',
            default=None,
            help=('Action to perform:\n%s.' %
                  ',\n'.join(map(lambda name: ' - ' + name, sorted(ACTIONS)))),
Example #5
0
 def get_name(cls):
     """Returns this action's name."""
     name = cls.NAME
     if name is None:
         name = cls.__name__
     return base.un_camel_case(name, separator='-')