How to use the termcolor.blue function in termcolor

To help you get started, we’ve selected a few termcolor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PenguPilot / PenguPilot / svctrl / processes.py View on Github external
def start(name, path, args):
   if args:
      path += ' ' + args
   if validate(name):
      print green('note:') + ' %s is already running' % name
   else:
      print 'starting', blue(name), '...',
      ps = subprocess.Popen(path.split(' '), shell = False, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
      ps.stdout.close()
      ps.stderr.close()
      ps.wait()
      if ps.returncode != 0:
         print red('[ERROR: service quit with code ' + str(ps.returncode) + ']')
      else:
         for _ in range(30):
            time.sleep(0.1)
            try:
               pid = validate(name)
               if pid:
                   break
            except:
               pass
         if not pid:
github PenguPilot / PenguPilot / svctrl / processes.py View on Github external
def stop(name):
   print 'stopping', blue(name), '...',
   pid = validate(name)
   if pid:
      kill(pid)
      while validate(name):
         time.sleep(0.1)
      print green('[OK]')
   else:
      print red('[ERROR: no such process]')
github PenguPilot / PenguPilot / svctrl / svctrl.py View on Github external
name_len = len(name)
         if name_len > max_name_len:
            max_name_len = name_len
      for name, (path, _) in config.items():
         skip = ' ' * (max_name_len - len(name))
         pid = validate(name)
         if pid:
            ex_str = green('running [%d]' % pid)
         else:
            ex_str = red('not running')
         try:
            if len(config[name][1]) > 0:
               ex_str += '\t(deps: ' + ', '.join(config[name][1]) + ')'
         except:
            pass
         print '%s:%s %s' % (blue(name), skip, ex_str)

   elif args[0] in ['start', 'stop']:
      try:
         name = args[1]
         data = config[name]
         if args[0] == 'start':
            names = start_order(name)
            if len(names) > 1:
               print 'dependency resolution order:', names
            for name in names:
               start(name, config[name][0], args[2])
         else:
            running = running_processes()
            names = []
            for service in restart_order(name):
               if service in running: