Compare commits

..

4 Commits

Author SHA1 Message Date
kdurant 93fe658574 add install.sh 2026-02-21 15:29:15 +00:00
andy.boot 709b87e137 docs: Update README.md 2026-01-08 23:30:04 +00:00
andy.boot 3a16a6a234 version: increment version 2026-01-08 23:16:16 +00:00
andy.boot 2066b7fa86 Revert "build: Attempt to add deb musl build."
This reverts commit 37dd671e5e.
2026-01-08 23:03:10 +00:00
9 changed files with 259 additions and 12 deletions
-5
View File
@@ -126,11 +126,6 @@ jobs:
target: x86_64-unknown-linux-musl,
use-cross: use-cross,
}
- {
os: deb-latest,
target: x86_64-unknown-linux-musl,
use-cross: use-cross,
}
- { os: macos-latest, target: x86_64-apple-darwin }
- { os: windows-latest, target: i686-pc-windows-gnu }
- { os: windows-latest, target: i686-pc-windows-msvc }
Generated
+1 -1
View File
@@ -296,7 +296,7 @@ dependencies = [
[[package]]
name = "du-dust"
version = "1.2.3"
version = "1.2.4"
dependencies = [
"assert_cmd",
"chrono",
+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "du-dust"
description = "A more intuitive version of du"
version = "1.2.3"
version = "1.2.4"
authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"]
edition = "2024"
readme = "README.md"
+9 -2
View File
@@ -16,7 +16,7 @@ Because I want an easy way to see where my disk is being used.
Study the above picture.
* We see `target` has 1.8G
* `target/debug` is the same size as `target` - so we know nearly all the disk usage of the 1.5G is in this folder
* `target/debug` is the same size as `target` - so we know nearly all the disk usage of the 1.8G is in this folder
* `target/debug/deps` this is 1.2G - Note the bar jumps down to 70% to indicate that most disk usage is here but not all.
* `target/debug/deps/dust-e78c9f87a17f24f3` - This is the largest file in this folder, but it is only 46M - Note the bar jumps down to 3% to indicate the file is small.
@@ -26,7 +26,14 @@ From here we can conclude:
## Install
#### Cargo <a href="https://repology.org/project/du-dust/versions"><img src="https://repology.org/badge/vertical-allrepos/du-dust.svg" alt="Packaging status" align="right"></a>
### Quick Install (Linux, macOS, Windows)
```bash
curl -sSfL https://raw.githubusercontent.com/bootandy/dust/refs/heads/master/install.sh | sh
```
### Cargo <a href="https://repology.org/project/du-dust/versions"><img src="https://repology.org/badge/vertical-allrepos/du-dust.svg" alt="Packaging status" align="right"></a>
#### Cargo
- `cargo install du-dust`
+3
View File
@@ -28,3 +28,6 @@ ignore-hidden=true
output-format="si"
number-of-lines=5
# To keep the .git directory collapsed
collapse=[".git"]
Executable
+233
View File
@@ -0,0 +1,233 @@
#!/usr/bin/env bash
# dust installer script
# Usage: curl -sSfL https://raw.githubusercontent.com/bootandy/dust/main/install.sh | sh
set -e
REPO="bootandy/dust"
BINARY_NAME="dust"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
error() {
echo -e "${RED}[ERROR]${NC} $1"
exit 1
}
# Detect OS
detect_os() {
case "$(uname -s)" in
Linux*) OS="linux" ;;
Darwin*) OS="darwin" ;;
MINGW*|MSYS*|CYGWIN*) OS="windows" ;;
*) error "Unsupported operating system: $(uname -s)" ;;
esac
}
# Detect architecture
detect_arch() {
ARCH=$(uname -m)
case "$ARCH" in
x86_64|amd64) ARCH="x86_64" ;;
aarch64|arm64) ARCH="aarch64" ;;
armv7l) ARCH="arm" ;;
i686|i386) ARCH="i686" ;;
*) error "Unsupported architecture: $ARCH" ;;
esac
}
# Get the latest release version
get_latest_version() {
info "Fetching latest version..."
# Try using curl
if command -v curl >/dev/null 2>&1; then
VERSION=$(curl -sSf "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | sed -E 's/.*"v?([^"]+)".*/\1/')
# Try using wget
elif command -v wget >/dev/null 2>&1; then
VERSION=$(wget -qO- "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | sed -E 's/.*"v?([^"]+)".*/\1/')
else
error "Neither curl nor wget is available. Please install one of them."
fi
if [ -z "$VERSION" ]; then
error "Failed to fetch latest version"
fi
info "Latest version: v$VERSION"
}
# Determine target triple
get_target() {
if [ "$OS" = "linux" ]; then
if [ "$ARCH" = "x86_64" ]; then
TARGET="x86_64-unknown-linux-musl"
elif [ "$ARCH" = "aarch64" ]; then
TARGET="aarch64-unknown-linux-musl"
elif [ "$ARCH" = "arm" ]; then
TARGET="arm-unknown-linux-musleabi"
elif [ "$ARCH" = "i686" ]; then
TARGET="i686-unknown-linux-musl"
else
error "Unsupported Linux architecture: $ARCH"
fi
elif [ "$OS" = "darwin" ]; then
if [ "$ARCH" = "x86_64" ]; then
TARGET="x86_64-apple-darwin"
elif [ "$ARCH" = "aarch64" ]; then
# For Apple Silicon, use x86_64 with Rosetta if native build not available
TARGET="x86_64-apple-darwin"
warn "Using x86_64 binary (will run via Rosetta 2 on Apple Silicon)"
else
error "Unsupported macOS architecture: $ARCH"
fi
elif [ "$OS" = "windows" ]; then
if [ "$ARCH" = "x86_64" ]; then
TARGET="x86_64-pc-windows-msvc"
elif [ "$ARCH" = "i686" ]; then
TARGET="i686-pc-windows-msvc"
else
error "Unsupported Windows architecture: $ARCH"
fi
else
error "Unsupported OS: $OS"
fi
info "Target platform: $TARGET"
}
# Download and extract
download_and_install() {
# Construct download URL
if [ "$OS" = "windows" ]; then
ARCHIVE_NAME="dust-v${VERSION}-${TARGET}.zip"
ARCHIVE_EXT="zip"
else
ARCHIVE_NAME="dust-v${VERSION}-${TARGET}.tar.gz"
ARCHIVE_EXT="tar.gz"
fi
DOWNLOAD_URL="https://github.com/$REPO/releases/download/v${VERSION}/${ARCHIVE_NAME}"
info "Downloading from: $DOWNLOAD_URL"
# Create temporary directory
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR"
# Download
if command -v curl >/dev/null 2>&1; then
curl -sSfL "$DOWNLOAD_URL" -o "$ARCHIVE_NAME" || error "Download failed"
elif command -v wget >/dev/null 2>&1; then
wget -q "$DOWNLOAD_URL" -O "$ARCHIVE_NAME" || error "Download failed"
fi
# Extract
info "Extracting archive..."
if [ "$ARCHIVE_EXT" = "tar.gz" ]; then
tar -xzf "$ARCHIVE_NAME" || error "Extraction failed"
elif [ "$ARCHIVE_EXT" = "zip" ]; then
unzip -q "$ARCHIVE_NAME" || error "Extraction failed"
fi
# Find the binary (it might be in a subdirectory)
if [ "$OS" = "windows" ]; then
BINARY_PATH=$(find . -name "${BINARY_NAME}.exe" | head -n 1)
else
BINARY_PATH=$(find . -name "$BINARY_NAME" -type f | head -n 1)
fi
if [ -z "$BINARY_PATH" ]; then
error "Binary not found in archive"
fi
# Determine installation directory
if [ -n "$DUST_INSTALL" ]; then
INSTALL_DIR="$DUST_INSTALL"
elif [ -w "/usr/local/bin" ]; then
INSTALL_DIR="/usr/local/bin"
elif [ -w "$HOME/.local/bin" ]; then
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
else
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
fi
# Install binary
info "Installing to $INSTALL_DIR..."
if [ -w "$INSTALL_DIR" ]; then
cp "$BINARY_PATH" "$INSTALL_DIR/" || error "Installation failed"
chmod +x "$INSTALL_DIR/$BINARY_NAME" || true
else
# Try with sudo
warn "Installing with sudo (requires administrator privileges)..."
sudo cp "$BINARY_PATH" "$INSTALL_DIR/" || error "Installation failed"
sudo chmod +x "$INSTALL_DIR/$BINARY_NAME" || true
fi
# Clean up
cd - > /dev/null
rm -rf "$TMP_DIR"
info "${GREEN}${NC} dust v$VERSION installed successfully!"
# Check if install directory is in PATH
case ":$PATH:" in
*:$INSTALL_DIR:*)
;;
*)
warn "⚠️ $INSTALL_DIR is not in your PATH"
warn " Add the following to your shell config (~/.bashrc, ~/.zshrc, etc.):"
echo ""
echo " export PATH=\"$INSTALL_DIR:\$PATH\""
echo ""
;;
esac
# Show version
if command -v "$BINARY_NAME" >/dev/null 2>&1; then
info "Version check:"
"$BINARY_NAME" --version || true
fi
}
# Main execution
main() {
info "dust installer"
echo ""
# Check for required tools
if ! command -v tar >/dev/null 2>&1 && ! command -v unzip >/dev/null 2>&1; then
error "Neither tar nor unzip is available. Please install one of them."
fi
detect_os
detect_arch
get_latest_version
get_target
download_and_install
echo ""
info "Installation complete! Try running: ${GREEN}dust${NC}"
}
# Allow version to be specified via environment variable
if [ -n "$DUST_VERSION" ]; then
VERSION="$DUST_VERSION"
fi
main
+2 -2
View File
@@ -1,6 +1,6 @@
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.TH Dust 1 "Dust 1.2.3"
.TH Dust 1 "Dust 1.2.4"
.SH NAME
Dust \- Like du but more intuitive
.SH SYNOPSIS
@@ -170,4 +170,4 @@ Print version
[\fIPATH\fR]
Input files or directories
.SH VERSION
v1.2.3
v1.2.4
+9
View File
@@ -38,6 +38,7 @@ pub struct Config {
pub files0_from: Option<String>,
pub number_of_lines: Option<usize>,
pub files_from: Option<String>,
pub collapse: Option<Vec<String>>,
}
impl Config {
@@ -177,6 +178,14 @@ impl Config {
pub fn get_changed_time_operator(&self, options: &Cli) -> Option<(Operator, i64)> {
get_filter_time_operator(options.ctime.as_ref(), get_current_date_epoch_seconds())
}
pub fn get_collapse(&self, options: &Cli) -> Option<Vec<String>> {
if self.collapse.is_none() {
options.collapse.clone()
} else {
self.collapse.clone()
}
}
}
fn get_current_date_epoch_seconds() -> i64 {
+1 -1
View File
@@ -224,7 +224,7 @@ fn main() {
indicator.spawn(output_format.clone())
}
let keep_collapsed: HashSet<PathBuf> = match options.collapse {
let keep_collapsed: HashSet<PathBuf> = match config.get_collapse(&options) {
Some(ref collapse) => {
let mut combined_dirs = HashSet::new();
for collapse_dir in collapse {