Exemple #1
0
    def is_compatible(cmd):
        """Check if this subcommand can work with the given command.
        
        Args:
            cmd (str): A command from the command line, e.g. sys.argv[1].

        Returns:
            bool: True if this subcommand is compatible with `cmd`.
        """
        return os.path.basename(cmd) in [info.command for info in Knowledgebase.all_compilers()]
Exemple #2
0
    def is_compatible(cmd):
        """Check if this subcommand can work with the given command.
        
        Args:
            cmd (str): A command from the command line, e.g. sys.argv[1].

        Returns:
            bool: True if this subcommand is compatible with `cmd`.
        """
        return os.path.basename(cmd) in [
            info.command for info in Knowledgebase.all_compilers()
        ]
Exemple #3
0
 def _construct_parser(self):
     parts = ['  %s  %s' % ('{:<15}'.format(comp.command), comp.short_descr) 
              for comp in Knowledgebase.all_compilers()]
     epilog = "known compiler commands and their roles:\n%s\n" % '\n'.join(sorted(parts))
     usage = "%s <command> [arguments]" % self.command
     parser = arguments.get_parser(prog=self.command, usage=usage, description=self.summary, epilog=epilog)
     parser.add_argument('cmd',
                         help="Compiler or linker command, e.g. 'gcc'",
                         metavar='<command>')
     parser.add_argument('cmd_args', 
                         help="Compiler arguments",
                         metavar='[arguments]',
                         nargs=arguments.REMAINDER)
     return parser
Exemple #4
0
 def _construct_parser(self):
     parts = [
         '  %s  %s' % ('{:<15}'.format(comp.command), comp.short_descr)
         for comp in Knowledgebase.all_compilers()
     ]
     epilog = "known compiler commands and their roles:\n%s\n" % '\n'.join(
         sorted(parts))
     usage = "%s <command> [arguments]" % self.command
     parser = arguments.get_parser(prog=self.command,
                                   usage=usage,
                                   description=self.summary,
                                   epilog=epilog)
     parser.add_argument('cmd',
                         help="Compiler or linker command, e.g. 'gcc'",
                         metavar='<command>')
     parser.add_argument('cmd_args',
                         help="Compiler arguments",
                         metavar='[arguments]',
                         nargs=arguments.REMAINDER)
     return parser