Skip to content

Commit

Permalink
Add doc comments. Add doc test. (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleury authored Sep 6, 2024
1 parent 04342ff commit 0892d45
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ on:
- "README.md"
- "LICENSE-*"
- ".gitignore"
pull_request:
branches: ["main"]
paths-ignore:
- "README.md"
- "LICENSE-*"
- ".gitignore"
env:
CARGO_TERM_COLOR: always

Expand Down
1 change: 0 additions & 1 deletion src/bytes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(clippy::cast_precision_loss)]

use std::fmt::Display;

pub fn humanize(bytes: u64) -> String {
Expand Down
12 changes: 12 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Find large files on your system.
mod bytes;
mod files;

Expand All @@ -10,6 +11,17 @@ use files::File;
/// # Errors
///
/// Returns an I/O error if unable to scan the provided path.
///
/// # Examples
///
/// ```
/// # use spacehog::find_top_n_largest_files;
/// # fn main() {
/// let result = find_top_n_largest_files("testdata", 5).unwrap();
///
/// assert_eq!(result.len(), 4);
/// # }
/// ```
pub fn find_top_n_largest_files(path: &str, n: usize) -> io::Result<Vec<File>> {
let mut results = BTreeMap::new();
for file in files::from_path(path)? {
Expand Down
11 changes: 11 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
//! A simple utility for finding large files on your system.
//!
//! Usage: spacehog [OPTIONS] [PATH]
//!
//! Arguments:
//! [PATH] [default: .]
//!
//! Options:
//! -n <NUMBER> [default: 5]
//! -h, --help Print help
//! -V, --version Print version
use clap::Parser;
use spinoff::{spinners, Color, Spinner};

Expand Down

0 comments on commit 0892d45

Please sign in to comment.