Beispiel #1
0
    def run(self):
        args = base_parser.parse_args()
        if args.target is None:
            ## TODO: add the target descriptions to the help output
            base_parser.print_help()
            print self.gen_help()
            return
        targets = {}
        for target in self.targets:
            if targets.has_key(target.name):
                raise Exception('invalid PBJ configuration; multiple rules for %s'
                                    % target.name)
            targets[target.name] = target

        if args.list:
            if args.target:
                items = args.target.split()[1:] ## the target is "pbj target_name"
                if items and items[0] in targets:
                    target = targets[items[0]]
                    print ' '.join(target.get_completion(items[1:]))
                    return

            # print args.target
            print ' '.join(targets.keys())
            return

        elif args.zsh:
            print ZSH_OUT
            return 

        if args.target in targets:
            target = targets[args.target]
            target.build(self, args.rest)
        else:
            LOG.error('Unknown target %s' % args.target)