Compare commits
No commits in common. "81aa7a8984e7fd24f7a5bd4b88d8add7cc058410" and "f6d01068a3bf3ef98a343375d18d808e1ced784a" have entirely different histories.
81aa7a8984
...
f6d01068a3
7 changed files with 11 additions and 11 deletions
3
deja_vu/.envrc
Normal file
3
deja_vu/.envrc
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
export DEJA_VU_CONFIG=`pwd`/config
|
||||||
|
export DEJA_VU_DATA=`pwd`/data
|
||||||
|
export DEJA_VU_LOG_LEVEL=debug
|
||||||
|
|
@ -21,6 +21,7 @@ edition = "2021"
|
||||||
license = "GPL"
|
license = "GPL"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
{
|
{
|
||||||
"app_title": "Deja-vu: Clone Tool",
|
|
||||||
"clone_app_path": "C:/Program Files/Some Clone Tool/app.exe",
|
"clone_app_path": "C:/Program Files/Some Clone Tool/app.exe",
|
||||||
"keybindings": {
|
"keybindings": {
|
||||||
"ScanDisks": {
|
"ScanDisks": {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Deja-vu. If not, see <https://www.gnu.org/licenses/>.
|
// along with Deja-vu. If not, see <https://www.gnu.org/licenses/>.
|
||||||
//
|
//
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
iter::zip,
|
iter::zip,
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ impl Component for Title {
|
||||||
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
|
fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> {
|
||||||
// Title Block
|
// Title Block
|
||||||
let title_text = Span::styled(
|
let title_text = Span::styled(
|
||||||
self.config.app_title.as_str(),
|
"WizardKit: Clone Tool",
|
||||||
Style::default().fg(Color::LightCyan),
|
Style::default().fg(Color::LightCyan),
|
||||||
);
|
);
|
||||||
let title = Paragraph::new(Line::from(title_text).centered())
|
let title = Paragraph::new(Line::from(title_text).centered())
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,6 @@ pub struct AppConfig {
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize)]
|
#[derive(Clone, Debug, Default, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
#[serde(default)]
|
|
||||||
pub app_title: String,
|
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub clone_app_path: PathBuf,
|
pub clone_app_path: PathBuf,
|
||||||
#[serde(default, flatten)]
|
#[serde(default, flatten)]
|
||||||
|
|
@ -70,13 +68,12 @@ impl Config {
|
||||||
let data_dir = get_data_dir();
|
let data_dir = get_data_dir();
|
||||||
let config_dir = get_config_dir();
|
let config_dir = get_config_dir();
|
||||||
let mut builder = config::Config::builder()
|
let mut builder = config::Config::builder()
|
||||||
.set_default("app_title", default_config.app_title.as_str())?
|
.set_default("data_dir", data_dir.to_str().unwrap())?
|
||||||
|
.set_default("config_dir", config_dir.to_str().unwrap())?
|
||||||
.set_default(
|
.set_default(
|
||||||
"clone_app_path",
|
"clone_app_path",
|
||||||
String::from("C:\\Program Files\\Some Clone Tool\\app.exe"),
|
String::from("C:\\Program Files\\Some Clone Tool\\app.exe"),
|
||||||
)?
|
)?;
|
||||||
.set_default("config_dir", config_dir.to_str().unwrap())?
|
|
||||||
.set_default("data_dir", data_dir.to_str().unwrap())?;
|
|
||||||
|
|
||||||
let config_files = [
|
let config_files = [
|
||||||
("config.json5", config::FileFormat::Json5),
|
("config.json5", config::FileFormat::Json5),
|
||||||
|
|
@ -98,6 +95,7 @@ impl Config {
|
||||||
if !found_config {
|
if !found_config {
|
||||||
error!("No configuration file found. Application may not behave as expected");
|
error!("No configuration file found. Application may not behave as expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut cfg: Self = builder.build()?.try_deserialize()?;
|
let mut cfg: Self = builder.build()?.try_deserialize()?;
|
||||||
|
|
||||||
for (mode, default_bindings) in default_config.keybindings.iter() {
|
for (mode, default_bindings) in default_config.keybindings.iter() {
|
||||||
|
|
@ -142,7 +140,7 @@ pub fn get_config_dir() -> PathBuf {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn project_directory() -> Option<ProjectDirs> {
|
fn project_directory() -> Option<ProjectDirs> {
|
||||||
ProjectDirs::from("com", "Deja-vu", env!("CARGO_PKG_NAME"))
|
ProjectDirs::from("com", "WizardKit", env!("CARGO_PKG_NAME"))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deref, DerefMut)]
|
#[derive(Clone, Debug, Default, Deref, DerefMut)]
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ pub fn render(app: &mut App, frame: &mut Frame) {
|
||||||
.split(frame.size());
|
.split(frame.size());
|
||||||
|
|
||||||
// Title Block
|
// Title Block
|
||||||
let title_text = Span::styled("Deja-vu: PE Menu", Style::default().fg(Color::LightCyan));
|
let title_text = Span::styled("WizardKit: PE Menu", Style::default().fg(Color::LightCyan));
|
||||||
let title = Paragraph::new(Line::from(title_text).centered())
|
let title = Paragraph::new(Line::from(title_text).centered())
|
||||||
.block(Block::default().borders(Borders::ALL));
|
.block(Block::default().borders(Borders::ALL));
|
||||||
frame.render_widget(title, chunks[0]);
|
frame.render_widget(title, chunks[0]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue