mergin/cli.py
def create(ctx, project, public, from_dir):
    """Create a new project on Mergin server. `project` needs to be a combination of namespace/project."""
    mc = ctx.obj["client"]
    if mc is None:
        return
    if "/" in project:
        try:
            namespace, project = project.split("/")
            assert namespace, "No namespace given"
            assert project, "No project name given"
        except (ValueError, AssertionError) as e:
            click.secho(f"Incorrect namespace/project format: {e}", fg="red")
            return
    else:
        # namespace not specified, use current user namespace
        namespace = mc.username()
    try:
        if from_dir is None:
            mc.create_project(project, is_public=public, namespace=namespace)
            click.echo("Created project " + project)
        else:
            mc.create_project_and_push(project, from_dir, is_public=public, namespace=namespace)
            click.echo("Created project " + project + " and pushed content from directory " + from_dir)
    except ClientError as e:
        click.secho("Error: " + str(e), fg="red")
        return
    except Exception as e:
        _print_unhandled_exception()
Create a new project on Mergin server. `project` needs to be a combination of namespace/project.
Create a new project on Mergin server. `project` needs to be a combination of namespace/project.
Create a new project on Mergin server . ` project ` needs to be a combination of namespace / project .
def create(ctx, project, public, from_dir):
    mc = ctx.obj["client"]
    if mc is None:
        return
    if "/" in project:
        try:
            namespace, project = project.split("/")
            assert namespace, "No namespace given"
            assert project, "No project name given"
        except (ValueError, AssertionError) as e:
            click.secho(f"Incorrect namespace/project format: {e}", fg="red")
            return
    else:
        namespace = mc.username()
    try:
        if from_dir is None:
            mc.create_project(project, is_public=public, namespace=namespace)
            click.echo("Created project " + project)
        else:
            mc.create_project_and_push(project, from_dir, is_public=public, namespace=namespace)
            click.echo("Created project " + project + " and pushed content from directory " + from_dir)
    except ClientError as e:
        click.secho("Error: " + str(e), fg="red")
        return
    except Exception as e:
        _print_unhandled_exception()
def create ( ctx , project , public , from_dir ) : mc = ctx . obj [ "client" ] if mc is None : return if "/" in project : try : namespace , project = project . split ( "/" ) assert namespace , "No namespace given" assert project , "No project name given" except ( ValueError , AssertionError ) as e : click . secho ( f"Incorrect namespace/project format: {e}" , fg = "red" ) return else : namespace = mc . username ( ) try : if from_dir is None : mc . create_project ( project , is_public = public , namespace = namespace ) click . echo ( "Created project " + project ) else : mc . create_project_and_push ( project , from_dir , is_public = public , namespace = namespace ) click . echo ( "Created project " + project + " and pushed content from directory " + from_dir ) except ClientError as e : click . secho ( "Error: " + str ( e ) , fg = "red" ) return except Exception as e : _print_unhandled_exception ( )
Create a new project on Mergin server.
Create a new project on Mergin server .
"""Create a new project on Mergin server. `project` needs to be a combination of namespace/project.""" # namespace not specified, use current user namespace
ctx
project
public
from_dir