Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(
        description="provides various info about components/workspaces")
    parser.add_argument('argument', nargs='?', choices=['list', 'listws'])

    argcomplete.autocomplete(parser)
    args = parser.parse_args()

    if args.argument == 'list':
        components = WS.list_packages(WS.workspace_paths)
        componentsname = []
        for component in components:
            componentsname.append(
                component.split('/')[len(component.split('/')) - 1])
        opstring = "   ".join(componentsname)
        print(opstring)
    elif args.argument == 'listws':
        home = os.path.expanduser("~")
        print("registered workspaces are : \n")
        with open(os.path.join(home,
                               ".config/RoboComp/rc_workspace.config")) as f:
            print(f.read())
        print("\tuse 'rc_init_ws' to register a workspace")
    else:
        parser.error("sorry no such option is available ")
Exemplo n.º 2
0
def complete_components(prefix, **kwargs):
    components = WS.list_packages(WS.workspace_paths)
    componentsname = []
    for component in components:
        componentsname.append(
            component.split('/')[len(component.split('/')) - 1])
    return (componentname for componentname in componentsname
            if componentname.startswith(prefix))
Exemplo n.º 3
0
def main():
    parser = argparse.ArgumentParser(description="provides various info about components/workspaces")
    parser.add_argument('argument', nargs='?', choices=['list','listws'])
    
    argcomplete.autocomplete(parser)
    args = parser.parse_args()

    if args.argument=='list':
        components = WS.list_packages(WS.workspace_paths)
        componentsname=[]
        for component in components:
            componentsname.append(component.split('/')[ len(component.split('/')) -1 ])
        opstring = "   ".join(componentsname)
        print(opstring)
    elif args.argument == 'listws':
        home = os.path.expanduser("~")
        print("registered workspaces are : \n")
        with open(os.path.join(home,".config/RoboComp/rc_workspace.config")) as f:
            print(f.read())
        print("\tuse 'rc_init_ws' to register a workspace")
    else:
        parser.error("sorry no such option is available ")
Exemplo n.º 4
0
def complete_components(prefix, **kwargs):
    components = WS.list_packages(WS.workspace_paths)
    componentsname=[]
    for component in components:
        componentsname.append(component.split('/')[ len(component.split('/')) -1 ])
    return (componentname for componentname in componentsname if componentname.startswith(prefix))