Skip to content

Commit

Permalink
refactor: remove out-paths format
Browse files Browse the repository at this point in the history
  • Loading branch information
louib committed Oct 13, 2024
1 parent 1671b3f commit e045f5e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
9 changes: 0 additions & 9 deletions src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pub enum Format {
SPDX,
CycloneDX,
PrettyPrint,
OutPaths,
Stats,
}

Expand All @@ -26,9 +25,6 @@ impl Format {
if format.ends_with("pretty") {
return Some(Format::PrettyPrint);
}
if format.ends_with("out-paths") {
return Some(Format::OutPaths);
}
if format.ends_with("stats") {
return Some(Format::Stats);
}
Expand All @@ -40,7 +36,6 @@ impl Format {
Format::CycloneDX => CYCLONE_DX_NAME.to_string(),
Format::SPDX => SPDX_NAME.to_string(),
Format::PrettyPrint => PRETTY_PRINT_NAME.to_string(),
Format::OutPaths => OUT_PATHS_NAME.to_string(),
Format::Stats => STATS_NAME.to_string(),
}
}
Expand All @@ -52,7 +47,6 @@ impl Format {
Format::Stats => SerializationFormat::JSON,
// We don't really care which value is returned in those cases.
Format::PrettyPrint => SerializationFormat::XML,
Format::OutPaths => SerializationFormat::XML,
}
}

Expand Down Expand Up @@ -85,9 +79,6 @@ impl Format {

return Ok(package_graph.pretty_print(0, &display_options));
}
Format::OutPaths => {
return Ok(package_graph.print_out_paths());
}
Format::Stats => {
return Ok(serde_json::to_string_pretty(&package_graph.get_stats(options))?);
}
Expand Down
27 changes: 0 additions & 27 deletions src/nix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,22 +965,6 @@ impl PackageNode {
return serde_json::to_string_pretty(self).map_err(|e| e.to_string());
}

pub fn print_out_paths(&self, package_graph: &PackageGraph, depth: usize) -> String {
if is_stdenv(&self.main_derivation.get_name().unwrap_or("".to_string())) {
return "".to_string();
}

let mut response = "".to_string();
for child_derivation_path in self.children.iter() {
let child_derivation = package_graph.nodes.get(child_derivation_path).unwrap();

let out_path = " ".repeat(depth) + &child_derivation_path + "\n";
response += &out_path;
response += &child_derivation.print_out_paths(package_graph, depth + 1);
}
response
}

pub fn pretty_print(
&self,
graph: &PackageGraph,
Expand Down Expand Up @@ -1517,17 +1501,6 @@ impl PackageGraph {
response
}

pub fn print_out_paths(&self) -> String {
let mut response: String = "".to_string();
for derivation_path in &self.root_nodes {
let out_path = " ".repeat(0) + &derivation_path + "\n";
response += &out_path;
let child_derivation = self.nodes.get(derivation_path).unwrap();
response += &child_derivation.print_out_paths(self, 1);
}
response
}

pub fn pretty_print(&self, depth: usize, display_options: &DisplayOptions) -> String {
let mut lines: Vec<PrettyPrintLine> = vec![];
let mut response = "".to_string();
Expand Down

0 comments on commit e045f5e

Please sign in to comment.