1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * Copyright 2023 Thomas Hügel.
 * This file is part of Cargo Graphmod.
 * SPDX-License-Identifier: GPL-3.0-only
 */

use std::path::Path;

use crate::{dependencies_graph::DependenciesGraph, files_reader, dot_formatter};

pub fn run_app(directory: &str, pkg_name: &str) -> String {
    let path = Path::new(directory);
    let skip_length = path.iter().count();
    let mut trie = DependenciesGraph::new();
    files_reader::read_files(path, &mut trie, skip_length, pkg_name).expect(
        "Unable to read ./src; please consider changing to the root directory of your package."
    );
    dot_formatter::show(&trie)
}