Add some more scaffolding

This commit is contained in:
Teoh Han Hui 2024-06-29 14:59:05 +08:00
parent 474c339599
commit fd413caba4
No known key found for this signature in database
GPG key ID: D43E2BABAF97DCAE
5 changed files with 265 additions and 3 deletions

View file

@ -13,6 +13,7 @@ default-run = "hyfetch"
# ansi_colours = { workspace = true, features = ["rgb"] }
anyhow = { workspace = true, features = ["std"] }
bpaf = { workspace = true, features = [] }
chrono = { workspace = true, features = ["clock", "std"] }
# derive_more = { workspace = true, features = ["std"] }
indexmap = { workspace = true, features = ["std"] }
rgb = { workspace = true, features = [] }

View file

@ -1,4 +1,7 @@
use std::io::{self, IsTerminal};
use anyhow::{Context, Result};
use chrono::Datelike;
use hyfetch::cli_options::options;
use hyfetch::neofetch_util::get_distro_ascii;
use tracing::debug;
@ -22,6 +25,37 @@ fn main() -> Result<()> {
// TODO
// TODO
// let config = if options.config {
// create_config()
// } else {
// check_config(options.config_file)
// };
let now = chrono::Local::now();
let show_pride_month = options.june
|| now.month() == 6
// TODO
// && !config.pride_month_shown.contains(now.year())
// && !june_path.is_file()
&& io::stdout().is_terminal();
if show_pride_month
// TODO
// && !config.pride_month_disable
{
// TODO
// pride_month.start_animation();
println!();
println!("Happy pride month!");
println!("(You can always view the animation again with `hyfetch --june`)");
println!();
// TODO
}
// TODO
Ok(())
}

View file

@ -2,7 +2,7 @@ use std::borrow::Cow;
use std::ffi::OsStr;
#[cfg(unix)]
use std::os::unix::process::ExitStatusExt as _;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::{env, fmt};
@ -11,8 +11,8 @@ use tracing::debug;
/// Gets the absolute path of the neofetch command.
pub fn get_command_path() -> Result<PathBuf> {
if let Some(workspace_dir) = option_env!("CARGO_WORKSPACE_DIR") {
let path = PathBuf::from(workspace_dir);
if let Ok(workspace_dir) = env::var("CARGO_WORKSPACE_DIR") {
let path = Path::new(&workspace_dir);
if path.exists() {
let path = path.join("neofetch");
match path.try_exists() {