sonar/database.py
def add_new(name, path):
        """
        Add a new IP to the database

        Args:
            name (str): Name of the IP
            path (str): Path for the IP
        """
        active_repo = Repo.get_active()
        repo = Repo.get(active_repo)
        repo_path = repo["path"]
        init_toml = os.path.join(repo_path, Constants.SONAR_CONFIG_FILE_PATH)
        init_dict = toml.load(init_toml)
        init_dict["project"]["ips"] = [name]
        if "ips" not in init_dict:
            init_dict["ips"] = {}
        init_dict["ips"][name] = {
            "path": str(path).replace(str(repo_path), "")
        }
        with open(init_toml, "w") as f:
            toml.dump(init_dict, f)

        Add a new IP to the database

        Args:
            name (str): Name of the IP
            path (str): Path for the IP
        
Add a new IP to the database
Add a new IP to the database
def add_new(name, path):
        active_repo = Repo.get_active()
        repo = Repo.get(active_repo)
        repo_path = repo["path"]
        init_toml = os.path.join(repo_path, Constants.SONAR_CONFIG_FILE_PATH)
        init_dict = toml.load(init_toml)
        init_dict["project"]["ips"] = [name]
        if "ips" not in init_dict:
            init_dict["ips"] = {}
        init_dict["ips"][name] = {
            "path": str(path).replace(str(repo_path), "")
        }
        with open(init_toml, "w") as f:
            toml.dump(init_dict, f)
def add_new ( name , path ) : active_repo = Repo . get_active ( ) repo = Repo . get ( active_repo ) repo_path = repo [ "path" ] init_toml = os . path . join ( repo_path , Constants . SONAR_CONFIG_FILE_PATH ) init_dict = toml . load ( init_toml ) init_dict [ "project" ] [ "ips" ] = [ name ] if "ips" not in init_dict : init_dict [ "ips" ] = { } init_dict [ "ips" ] [ name ] = { "path" : str ( path ) . replace ( str ( repo_path ) , "" ) } with open ( init_toml , "w" ) as f : toml . dump ( init_dict , f )
Add a new IP to the database
Add a new IP to the database
"""
        Add a new IP to the database

        Args:
            name (str): Name of the IP
            path (str): Path for the IP
        """
name
Name of the IP
Name of the IP
path
Path for the IP
Path for the IP