def setup(self): @task def mytask(c, text, boolean=False, number=5): print(text) @task(aliases=['mytask27']) def mytask2(c): pass @task(aliases=['othertask'], default=True) def subtask(c): pass sub = Collection('sub', subtask) self.c = Collection(mytask, mytask2, sub) self.contexts = self.c.to_contexts() alias_tups = [list(x.aliases) for x in self.contexts] self.aliases = reduce(operator.add, alias_tups, []) # Focus on 'mytask' as it has the more interesting sig self.context = [x for x in self.contexts if x.name == 'mytask'][0]
def setup(self): @task def mytask(ctx, text, boolean=False, number=5): six.print_(text) @task(aliases=['mytask27']) def mytask2(ctx): pass @task(aliases=['othertask'], default=True) def subtask(ctx): pass sub = Collection('sub', subtask) self.c = Collection(mytask, mytask2, sub) self.contexts = self.c.to_contexts() alias_tups = [list(x.aliases) for x in self.contexts] self.aliases = reduce(operator.add, alias_tups, []) # Focus on 'mytask' as it has the more interesting sig self.context = [x for x in self.contexts if x.name == 'mytask'][0]