#!/usr/bin/env python

import os
import sys
import pprint
import radical.synapse       as rs
import radical.synapse.utils as rsu

# FIXME: support tags as flags

# ------------------------------------------------------------------------------
#
def emu_command (command):

    if not command:
        usage(msg="no command specified")

    info, ret, out = rs.emulate (command=command)
    pprint.pprint (info)

    rsu.store_profile (info, mode='emu')


# ------------------------------------------------------------------------------
#
def usage (msg=None, noexit=False):

    if  msg:
        print "\n      Error: %s" % msg

    print """
      usage     : %s <command>
      example   : %s sleep 10

"""

    if  msg:
        sys.exit (1)

    if  not noexit:
        sys.exit (0)


# ------------------------------------------------------------------------------
#
if __name__ == '__main__':

    emu_command (' '.join(sys.argv[1:]))


# ------------------------------------------------------------------------------

