feat(nushell): add nu_libs autoload package
Some checks failed
Public Repo Readiness / Check Public Repo Readiness (push) Has been cancelled
Some checks failed
Public Repo Readiness / Check Public Repo Readiness (push) Has been cancelled
fix(notgraph): replace sort_by with sort_by_key (clippy)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
use crate::types::{CrateGraph, FanStats, GraphStats, Hotspot, HotspotKind, ModStats, ModuleGraph};
|
use crate::types::{CrateGraph, FanStats, GraphStats, Hotspot, HotspotKind, ModStats, ModuleGraph};
|
||||||
|
use std::cmp::Reverse;
|
||||||
use std::collections::{HashMap, VecDeque};
|
use std::collections::{HashMap, VecDeque};
|
||||||
|
|
||||||
pub fn fan_stats(nodes: &[String], edges: &[(String, String)]) -> Vec<FanStats> {
|
pub fn fan_stats(nodes: &[String], edges: &[(String, String)]) -> Vec<FanStats> {
|
||||||
@@ -66,7 +67,7 @@ pub fn hotspots(stats: &[FanStats], top_n: usize) -> Vec<Hotspot> {
|
|||||||
let mut result = Vec::new();
|
let mut result = Vec::new();
|
||||||
|
|
||||||
let mut by_fan_in = stats.to_vec();
|
let mut by_fan_in = stats.to_vec();
|
||||||
by_fan_in.sort_by(|a, b| b.fan_in.cmp(&a.fan_in));
|
by_fan_in.sort_by_key(|b| Reverse(b.fan_in));
|
||||||
for s in by_fan_in.iter().take(top_n) {
|
for s in by_fan_in.iter().take(top_n) {
|
||||||
if s.fan_in > 0 {
|
if s.fan_in > 0 {
|
||||||
result.push(Hotspot {
|
result.push(Hotspot {
|
||||||
@@ -78,7 +79,7 @@ pub fn hotspots(stats: &[FanStats], top_n: usize) -> Vec<Hotspot> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut by_fan_out = stats.to_vec();
|
let mut by_fan_out = stats.to_vec();
|
||||||
by_fan_out.sort_by(|a, b| b.fan_out.cmp(&a.fan_out));
|
by_fan_out.sort_by_key(|b| Reverse(b.fan_out));
|
||||||
for s in by_fan_out.iter().take(top_n) {
|
for s in by_fan_out.iter().take(top_n) {
|
||||||
if s.fan_out > 0 {
|
if s.fan_out > 0 {
|
||||||
result.push(Hotspot {
|
result.push(Hotspot {
|
||||||
|
|||||||
10
nushell/.config/nushell/autoload/nu_libs.nu
Normal file
10
nushell/.config/nushell/autoload/nu_libs.nu
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# nu_libs — load all lib/* modules on shell startup
|
||||||
|
# Managed by notfiles (nushell package). Link with: notfiles link nushell
|
||||||
|
# lib/ai is excluded from lib/mod.nu (requires runtime deps) — loaded separately below.
|
||||||
|
# lib/extensions is excluded (requires external project repos) — load manually as needed.
|
||||||
|
|
||||||
|
const NU_LIBS = "/Users/joe/dev/nu_libs/lib/mod.nu"
|
||||||
|
const NU_LIBS_AI = "/Users/joe/dev/nu_libs/lib/ai/mod.nu"
|
||||||
|
|
||||||
|
use $NU_LIBS *
|
||||||
|
use $NU_LIBS_AI *
|
||||||
Reference in New Issue
Block a user