about summary refs log tree commit diff stats
path: root/crates/yt/src/config/default.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/yt/src/config/default.rs (renamed from yt/src/config/default.rs)18
1 files changed, 13 insertions, 5 deletions
diff --git a/yt/src/config/default.rs b/crates/yt/src/config/default.rs
index 926f422..4ed643b 100644
--- a/yt/src/config/default.rs
+++ b/crates/yt/src/config/default.rs
@@ -1,6 +1,7 @@
 // yt - A fully featured command line YouTube client
 //
 // Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
 // SPDX-License-Identifier: GPL-3.0-or-later
 //
 // This file is part of Yt.
@@ -13,19 +14,19 @@ use std::path::PathBuf;
 use anyhow::{Context, Result};
 
 fn get_runtime_path(name: &'static str) -> Result<PathBuf> {
-    let xdg_dirs = xdg::BaseDirectories::with_prefix(PREFIX)?;
+    let xdg_dirs = xdg::BaseDirectories::with_prefix(PREFIX);
     xdg_dirs
         .place_runtime_file(name)
         .with_context(|| format!("Failed to place runtime file: '{name}'"))
 }
 fn get_data_path(name: &'static str) -> Result<PathBuf> {
-    let xdg_dirs = xdg::BaseDirectories::with_prefix(PREFIX)?;
+    let xdg_dirs = xdg::BaseDirectories::with_prefix(PREFIX);
     xdg_dirs
         .place_data_file(name)
         .with_context(|| format!("Failed to place data file: '{name}'"))
 }
 fn get_config_path(name: &'static str) -> Result<PathBuf> {
-    let xdg_dirs = xdg::BaseDirectories::with_prefix(PREFIX)?;
+    let xdg_dirs = xdg::BaseDirectories::with_prefix(PREFIX);
     xdg_dirs
         .place_config_file(name)
         .with_context(|| format!("Failed to place config file: '{name}'"))
@@ -44,6 +45,13 @@ pub(super) fn create_path(path: PathBuf) -> Result<PathBuf> {
 
 pub(crate) const PREFIX: &str = "yt";
 
+pub(crate) mod global {
+    pub(crate) fn display_colors() -> bool {
+        // TODO: This should probably check if the output is a tty and otherwise return `false` <2025-02-14>
+        true
+    }
+}
+
 pub(crate) mod select {
     pub(crate) fn playback_speed() -> f64 {
         2.7
@@ -60,7 +68,7 @@ pub(crate) mod watch {
 }
 
 pub(crate) mod update {
-    pub(crate) fn max_backlog() -> u32 {
+    pub(crate) fn max_backlog() -> usize {
         20
     }
 }
@@ -70,7 +78,7 @@ pub(crate) mod paths {
 
     use anyhow::Result;
 
-    use super::{create_path, get_config_path, get_data_path, get_runtime_path, PREFIX};
+    use super::{PREFIX, create_path, get_config_path, get_data_path, get_runtime_path};
 
     // We download to the temp dir to avoid taxing the disk
     pub(crate) fn download_dir() -> Result<PathBuf> {