feat(config): add progress bar configuration options
Swadhin Biswas committed 7 months ago
a001cee
1 parent 857e37b
commit a001cee
1 file changed
+70 -0
Showing 1 changed file+70-0
▼src/config/mod.rs
+70-0
| @@ -348,3 +348,73 @@ impl Config { | ||
348 | 348 | } |
349 | 349 | |
350 | 350 | /// Create the config file with example content if it doesn't exist. |
351 | + pub fn create_default_config() -> std::io::Result<PathBuf> { | |
352 | + let path = Self::config_path(); | |
353 | + if !path.exists() { | |
354 | + if let Some(parent) = path.parent() { | |
355 | + std::fs::create_dir_all(parent)?; | |
356 | + } | |
357 | + std::fs::write(&path, EXAMPLE_CONFIG)?; | |
358 | + } | |
359 | + Ok(path) | |
360 | + } | |
361 | +} | |
362 | + | |
363 | +/// Full documented example configuration | |
364 | +const EXAMPLE_CONFIG: &str = r##"# ============================================================================= | |
365 | +# FetchX Configuration File | |
366 | +# Location: ~/.config/fetchx/config.toml | |
367 | +# | |
368 | +# FetchX is a fast, modern system info tool (neofetch clone in Rust). | |
369 | +# All options have sensible defaults — only set what you want to change. | |
370 | +# ============================================================================= | |
371 | + | |
372 | +# ─── Display Options ───────────────────────────────────────────────────────── | |
373 | + | |
374 | +# Disable all colors | |
375 | +# no_color = false | |
376 | + | |
377 | +# Enable bold text | |
378 | +# bold = true | |
379 | + | |
380 | +# Separator between label and value | |
381 | +# separator = ": " | |
382 | + | |
383 | + | |
384 | +# ─── Text Colors ───────────────────────────────────────────────────────────── | |
385 | +# Either "distro" for automatic color matching, or an array of 6 color numbers: | |
386 | +# [title, @, underline, subtitle, colon, info] | |
387 | +# | |
388 | +# Color numbers: 0=black, 1=red, 2=green, 3=yellow, 4=blue, | |
389 | +# 5=magenta, 6=cyan, 7=white, 8-255=256-color palette | |
390 | +# | |
391 | +# Examples: | |
392 | +# colors = "distro" # auto-detect from distro (default) | |
393 | +# colors = [4, 6, 1, 8, 8, 6] # blue title, cyan @, red underline, etc. | |
394 | +# colors = [6, 6] # cyan title & subtitle, rest default | |
395 | +colors = "distro" | |
396 | + | |
397 | + | |
398 | +# ─── ASCII Art / Logo ──────────────────────────────────────────────────────── | |
399 | + | |
400 | +# Image backend: "auto", "ascii", "kitty", "sixel", "chafa", "w3m", "iterm2", "off" | |
401 | +# "auto" = auto-detect based on terminal capabilities (RECOMMENDED) | |
402 | +# "ascii" = ASCII art logo (works everywhere) | |
403 | +# "kitty" = Kitty terminal graphics protocol | |
404 | +# "sixel" = Sixel graphics (requires img2sixel or chafa) | |
405 | +# "chafa" = Chafa text-based image conversion (best fallback) | |
406 | +# "w3m" = w3m image display (X11 only) | |
407 | +# "iterm2" = iTerm2 inline images | |
408 | +# "off" = no logo/image | |
409 | +image_backend = "auto" | |
410 | + | |
411 | +# Image source: "auto", "ascii", "/path/to/image.png" | |
412 | +# "auto" = automatically use cached image from API (downloads new ones every 6 hours) | |
413 | +# Shows previous image while downloading next one in background | |
414 | +# "ascii" = only use ASCII art, never fetch images | |
415 | +# "/path/to/image.png" = use specific image file | |
416 | +image_source = "auto" | |
417 | + | |
418 | +# Which distro's ASCII art to display (when using ASCII backend) | |
419 | +# Values: "auto", "arch", "ubuntu", "debian", "fedora", "gentoo", "nixos", | |
420 | +# "manjaro", "void", "pop", "cachyos", "endeavouros", "artix", "kali", | |
351 | 421 | |