예제 #1
0
 def main(self, argv):
     """Program entry point.
      
     Args:
         argv (list): Command line arguments.
          
     Returns:
         int: Process return code: non-zero if a problem occurred, 0 otherwise
     """
     args = self.parser.parse_args()
     cmd = args.command
     cmd_args = args.options
  
     logger.set_log_level(args.verbose)
     LOGGER.debug('Arguments: %s', args)
     LOGGER.debug('Verbosity level: %s', logger.LOG_LEVEL)
  
     # Try to execute as a TAU command
     try:
         return cli.execute_command([cmd], cmd_args)
     except UnknownCommandError:
         pass
  
     # Check shortcuts
     shortcut = None
     if build_command.is_compatible(cmd):
         shortcut = ['build']
         cmd_args = [cmd] + cmd_args
     elif trial_create_command.is_compatible(cmd):
         shortcut = ['trial', 'create']
         cmd_args = [cmd] + cmd_args
     elif cmd == 'show':
         shortcut = ['trial', 'show']
     if shortcut:
         LOGGER.debug('Trying shortcut: %s', shortcut)
         return cli.execute_command(shortcut, cmd_args)
     else:
         LOGGER.debug('No shortcut found for %r', cmd)
  
     # Not sure what to do at this point, so advise the user and exit
     LOGGER.info("Unknown command.  Calling `tau help %s` to get advice.", cmd)
     return cli.execute_command(['help'], [cmd])
예제 #2
0
 def main(self, argv):
     args = self.parser.parse_args(args=argv)
     return cli.execute_command([args.subcommand], args.options, self.module_name)