def make_command(self, ctx, name, info):

        """
        make click sub-command from command info
        gotten from xbahn engineer
        """

        @self.command()
        @click.option("--debug/--no-debug", default=False, help="Show debug information")
        @doc(info.get("description"))
        def func(*args, **kwargs):
            if "debug" in kwargs:
                del kwargs["debug"]
            fn = getattr(ctx.widget, name)
            result = fn(*args, **kwargs)
            click.echo("%s: %s> %s" % (ctx.params["host"],name,result))
            ctx.conn.close()

        ctx.info_name = "%s %s" % (ctx.info_name , ctx.params["host"])

        for a in info.get("arguments",[]):
            deco = click.argument(*a["args"], **a["kwargs"])
            func = deco(func)
        for o in info.get("options",[]):
            deco = click.option(*o["args"], **o["kwargs"])
            func = deco(func)

        return func
def make_command ( self , ctx , name , info ) : @ self . command ( ) @ click . option ( "--debug/--no-debug" , default = False , help = "Show debug information" ) @ doc ( info . get ( "description" ) ) def func ( * args , ** kwargs ) : if "debug" in kwargs : del kwargs [ "debug" ] fn = getattr ( ctx . widget , name ) result = fn ( * args , ** kwargs ) click . echo ( "%s: %s> %s" % ( ctx . params [ "host" ] , name , result ) ) ctx . conn . close ( ) ctx . info_name = "%s %s" % ( ctx . info_name , ctx . params [ "host" ] ) for a in info . get ( "arguments" , [ ] ) : deco = click . argument ( * a [ "args" ] , ** a [ "kwargs" ] ) func = deco ( func ) for o in info . get ( "options" , [ ] ) : deco = click . option ( * o [ "args" ] , ** o [ "kwargs" ] ) func = deco ( func ) return func
make click sub-command from command info
        gotten from xbahn engineer