tmt/cli.py
def init(context, path, mini, full, force, **kwargs):
    """
    Initialize a new tmt tree.

    By default tree is created in the current directory.
    Provide a PATH to create it in a different location.
    """

    # Check for existing tree
    path = os.path.realpath(path)
    try:
        tree = tmt.Tree(path)
        # Are we creating a new tree under the existing one?
        if path == tree.root:
            echo("Tree '{}' already exists.".format(tree.root))
        else:
            tree = None
    except tmt.utils.GeneralError:
        tree = None
    # Create a new tree
    if tree is None:
        try:
            fmf.Tree.init(path)
            tree = tmt.Tree(path)
        except fmf.utils.GeneralError as error:
            raise tmt.utils.GeneralError(
                "Failed to initialize tree in '{}': {}".format(
                    path, error))
        echo("Tree '{}' initialized.".format(tree.root))

    # Populate the tree with example objects if requested
    if mini:
        tmt.Test.create('/tests/example', 'shell', tree, force)
        tmt.Plan.create('/plans/example', 'mini', tree, force)
        tmt.Story.create('/stories/example', 'mini', tree, force)
    if full:
        tmt.Test.create('/tests/example', 'shell', tree, force)
        tmt.Plan.create('/plans/example', 'full', tree, force)
        tmt.Story.create('/stories/example', 'full', tree, force)

    Initialize a new tmt tree.

    By default tree is created in the current directory.
    Provide a PATH to create it in a different location.
    
Initialize a new tmt tree.
By default tree is created in the current directory.
Provide a PATH to create it in a different location.
Initialize a new tmt tree . By default tree is created in the current directory . Provide a PATH to create it in a different location .
def init(context, path, mini, full, force, **kwargs):
    path = os.path.realpath(path)
    try:
        tree = tmt.Tree(path)
        if path == tree.root:
            echo("Tree '{}' already exists.".format(tree.root))
        else:
            tree = None
    except tmt.utils.GeneralError:
        tree = None
    if tree is None:
        try:
            fmf.Tree.init(path)
            tree = tmt.Tree(path)
        except fmf.utils.GeneralError as error:
            raise tmt.utils.GeneralError(
                "Failed to initialize tree in '{}': {}".format(
                    path, error))
        echo("Tree '{}' initialized.".format(tree.root))
    if mini:
        tmt.Test.create('/tests/example', 'shell', tree, force)
        tmt.Plan.create('/plans/example', 'mini', tree, force)
        tmt.Story.create('/stories/example', 'mini', tree, force)
    if full:
        tmt.Test.create('/tests/example', 'shell', tree, force)
        tmt.Plan.create('/plans/example', 'full', tree, force)
        tmt.Story.create('/stories/example', 'full', tree, force)
def init ( context , path , mini , full , force , ** kwargs ) : path = os . path . realpath ( path ) try : tree = tmt . Tree ( path ) if path == tree . root : echo ( "Tree '{}' already exists." . format ( tree . root ) ) else : tree = None except tmt . utils . GeneralError : tree = None if tree is None : try : fmf . Tree . init ( path ) tree = tmt . Tree ( path ) except fmf . utils . GeneralError as error : raise tmt . utils . GeneralError ( "Failed to initialize tree in '{}': {}" . format ( path , error ) ) echo ( "Tree '{}' initialized." . format ( tree . root ) ) if mini : tmt . Test . create ( '/tests/example' , 'shell' , tree , force ) tmt . Plan . create ( '/plans/example' , 'mini' , tree , force ) tmt . Story . create ( '/stories/example' , 'mini' , tree , force ) if full : tmt . Test . create ( '/tests/example' , 'shell' , tree , force ) tmt . Plan . create ( '/plans/example' , 'full' , tree , force ) tmt . Story . create ( '/stories/example' , 'full' , tree , force )
Initialize a new tmt tree.
Initialize a new tmt tree .
"""
    Initialize a new tmt tree.

    By default tree is created in the current directory.
    Provide a PATH to create it in a different location.
    """ # Check for existing tree # Are we creating a new tree under the existing one? # Create a new tree # Populate the tree with example objects if requested
context
path
mini
full
force