mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 93fe658574 | |||
| 709b87e137 | |||
| 3a16a6a234 |
Generated
+1
-1
@@ -296,7 +296,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "du-dust"
|
name = "du-dust"
|
||||||
version = "1.2.3"
|
version = "1.2.4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assert_cmd",
|
"assert_cmd",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "du-dust"
|
name = "du-dust"
|
||||||
description = "A more intuitive version of du"
|
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>"]
|
authors = ["bootandy <bootandy@gmail.com>", "nebkor <code@ardent.nebcorp.com>"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Because I want an easy way to see where my disk is being used.
|
|||||||
Study the above picture.
|
Study the above picture.
|
||||||
|
|
||||||
* We see `target` has 1.8G
|
* 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` 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.
|
* `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
|
## 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`
|
- `cargo install du-dust`
|
||||||
|
|
||||||
|
|||||||
Executable
+233
@@ -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
@@ -1,6 +1,6 @@
|
|||||||
.ie \n(.g .ds Aq \(aq
|
.ie \n(.g .ds Aq \(aq
|
||||||
.el .ds Aq '
|
.el .ds Aq '
|
||||||
.TH Dust 1 "Dust 1.2.3"
|
.TH Dust 1 "Dust 1.2.4"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Dust \- Like du but more intuitive
|
Dust \- Like du but more intuitive
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -170,4 +170,4 @@ Print version
|
|||||||
[\fIPATH\fR]
|
[\fIPATH\fR]
|
||||||
Input files or directories
|
Input files or directories
|
||||||
.SH VERSION
|
.SH VERSION
|
||||||
v1.2.3
|
v1.2.4
|
||||||
|
|||||||
Reference in New Issue
Block a user