This commit is contained in:
Lucy 2025-09-30 22:10:02 +02:00
parent 941f75470b
commit b5dd2df0d3
3 changed files with 77 additions and 112 deletions

125
README.md
View file

@ -1,74 +1,103 @@
# 🌟 lpkg CLI Roadmap 🌈 # 🧬 LPKG Lightweight Package Manager
`lpkg` is going to have a cute, intuitive, and powerful CLI to **bootstrap environments** and **manage packages**. Each command is themed with emojis to make your workflow extra magical 💖✨. LPKG is a minimalistic package manager written in Rust, designed for fast and simple software management on Unix-like systems. It emphasizes reproducibility and declarative configuration, leveraging **Nix Flakes** for development and deployment.
--- ---
## ✨ Core Commands ## 🚀 Features
| Command | Emoji | Description | * **Fast & Lightweight** Minimal resource usage and quick operations.
| -------------------- | ----- | ------------------------------------------------- | * **Rust-Powered** Safe and concurrent code with Rust.
| `lpkg init` | 🌱 | Bootstraps a new environment from scratch | * **Cross-Platform** Works on Linux and macOS.
| `lpkg setup` | 🛠 | Sets up packages, dependencies, and config files | * **Declarative Builds** Fully reproducible with Nix Flakes.
| `lpkg install <pkg>` | 📦 | Installs a package | * **Simple CLI** Intuitive commands for managing packages.
| `lpkg update <pkg>` | 🔄 | Updates a package to the latest version |
| `lpkg remove <pkg>` | ❌ | Removes a package |
| `lpkg list` | 📜 | Lists all installed packages |
| `lpkg status` | 🔍 | Shows the status of your environment and packages |
--- ---
## 🌈 Advanced & Magical Commands ## ⚙️ Installation
| Command | Emoji | Description | ### Using Cargo
| ---------------- | ----- | ------------------------------------------------------------------------- |
| `lpkg bootstrap` | 🚀 | Full bootstrapping + package installation in one magical command |
| `lpkg doctor` | 🩺 | Checks your system for missing dependencies or broken configs |
| `lpkg clean` | 🧹 | Cleans up cache, temp files, and old builds |
| `lpkg export` | ✨📦 | Exports a manifest of installed packages (for sharing your magical setup) |
| `lpkg import` | ✨📥 | Imports a manifest to reproduce an environment exactly |
---
## 💫 Example Workflows
### 1⃣ Bootstrapping a new environment
```bash ```bash
lpkg init 🌱 cargo install lpkg
lpkg setup 🛠
lpkg install neovim 📦
lpkg install starship 📦
lpkg status 🔍
``` ```
### 2⃣ Updating packages ### Using Nix Flakes
If you have Nix with flakes enabled:
```bash ```bash
lpkg update starship 🔄 nix profile install github:lesbiannix/lpkg
lpkg update neovim 🔄
``` ```
### 3⃣ Cleaning up old stuff Or to run without installing:
```bash ```bash
lpkg clean 🧹 nix run github:lesbiannix/lpkg
```
### 4⃣ Sharing your magical setup
```bash
lpkg export ✨📦 > my-setup.yaml
lpkg import ✨📥 my-setup.yaml
``` ```
--- ---
## 🚀 Future CLI Enhancements ## 🧰 Usage
* 🏳️‍⚧️ Interactive CLI mode (`lpkg magic-mode ✨`) Basic command structure:
* 🌈 Auto-detect missing packages and suggest fixes (`lpkg auto-fix 🔮`)
* 💖 CLI themes with rainbow colors, cute prompts, and ASCII art 💫 ```bash
* 📦 Integration with Nix flakes for fully reproducible environments lpkg [command] [package]
```
Common commands:
* `install` Install a package
* `remove` Remove a package
* `update` Update the package list
* `upgrade` Upgrade all installed packages
For detailed usage:
```bash
lpkg --help
```
---
## 🔧 Development with Flakes
Clone the repository:
```bash
git clone https://github.com/lesbiannix/lpkg.git
cd lpkg
```
Enter the flake development shell:
```bash
nix develop
```
Build the project:
```bash
cargo build
```
Run tests:
```bash
cargo test
```
You can also run the project directly in the flake shell:
```bash
nix run
```
---
## 📄 License
LPKG is licensed under the [MIT License](LICENSE).

View file

@ -1,63 +0,0 @@
use anyhow::{Result, anyhow};
use std::collections::HashMap;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::Path;
use std::thread;
pub fn download_files(
files: &[String],
target_dir: &Path,
mirror: Option<&str>,
md5_map: Option<&HashMap<String, String>>,
) -> Result<()> {
fs::create_dir_all(target_dir)?;
let mut handles = vec![];
for url in files.iter().cloned() {
let target_dir = target_dir.to_path_buf();
let mirror = mirror.map(|m| m.to_string());
let md5_map = md5_map.cloned();
let handle = thread::spawn(move || -> Result<()> {
let download_url = if let Some(m) = &mirror {
url.replace("ftp.gnu.org", m)
} else {
url.clone()
};
let filename = download_url
.split('/')
.last()
.ok_or_else(|| anyhow!("Failed to extract filename"))?;
let filepath = target_dir.join(filename);
let mut resp = reqwest::blocking::get(&download_url)?;
let mut buffer = Vec::new();
resp.read_to_end(&mut buffer)?;
let mut file = File::create(&filepath)?;
file.write_all(&buffer)?;
if let Some(md5s) = md5_map.as_ref() {
if let Some(expected) = md5s.get(filename) {
let digest = md5::compute(&buffer);
if format!("{:x}", digest) != *expected {
return Err(anyhow!("MD5 mismatch for {}", filename));
}
}
}
Ok(())
});
handles.push(handle);
}
for handle in handles {
handle.join().map_err(|_| anyhow!("Thread panicked"))??;
}
Ok(())
}

View file

@ -3,7 +3,6 @@ use tracing::{error, info};
use tracing_appender::rolling::{RollingFileAppender, Rotation}; use tracing_appender::rolling::{RollingFileAppender, Rotation};
use tracing_subscriber::{EnvFilter, fmt, prelude::*}; use tracing_subscriber::{EnvFilter, fmt, prelude::*};
mod downloader;
mod tui; mod tui;
mod wget_list; mod wget_list;