Skip to content

Instantly share code, notes, and snippets.

@SaraVieira
Created September 29, 2022 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SaraVieira/dd8f80d8ffa6a7c523b386058e4e8024 to your computer and use it in GitHub Desktop.
Save SaraVieira/dd8f80d8ffa6a7c523b386058e4e8024 to your computer and use it in GitHub Desktop.
let a = Options {
file: options.file,
dist: options.dist,
..Options::default()
};
// ALWAYS RETURNS EMPTY
println!("{:?}", a);
use std::fs::{self};
use std::path::Path;
use toml::Value;
use twelf::config;
pub struct Downloads {}
// enum Theme {
// Light,
// Dark,
// }
#[config]
#[derive(Debug, Eq, PartialEq)]
pub struct Options {
// Your Readme.md name
pub file: Option<String>,
pub dist: Option<String>,
// pub name: String,
// pub logo: String,
// pub shareCard: String,
// pub homepage: String,
pub no_header: Option<bool>,
// pub theme: Theme,
// pub description: String,
}
impl Default for Options {
fn default() -> Self {
let mut name = String::new();
let cargo_file = "Cargo.toml";
if Path::new(cargo_file).exists() {
let file = fs::read_to_string(cargo_file).unwrap();
println!("{:?}", file)
};
Options {
file: Some("Readme".to_string()),
dist: Some("public".to_string()),
no_header: Some(false),
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment