Skip to content

Commit

Permalink
change: rename new-template-dir to data-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelohdez committed Feb 15, 2024
1 parent 5b9bedf commit 8b5bbba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::Parser;

pub const EDITOR_KEY: &str = "VISUAL";
pub const ALWAYS_DELETE_KEY: &str = "ATMPT_ALWAYS_DELETE";
pub const TEMPLATE_DIR_KEY: &str = "ATMPT_DATA_DIR";
pub const DATA_DIR_KEY: &str = "ATMPT_DATA_DIR";

#[derive(Debug, Parser)]
#[command(author, version, about)]
Expand All @@ -16,8 +16,8 @@ pub struct Atmpt {
#[arg(short = 'n', long, hide_env = true, env = ALWAYS_DELETE_KEY, help = "Delete project on exit")]
pub delete: bool,

#[arg(long, hide_env = true, env = TEMPLATE_DIR_KEY, help = "Override template dir")]
pub new_template_dir: Option<String>,
#[arg(long, hide_env = true, env = DATA_DIR_KEY, help = "Override data directory")]
pub data_dir: Option<String>,
}

#[derive(Debug, Parser)]
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fn main() -> anyhow::Result<()> {
let req = args.required;

let mut data_dir = Cow::Borrowed(dirs.data_dir());
if let Some(new_dir) = args.new_template_dir {
if let Some(new_dir) = args.data_dir {
data_dir = Cow::Owned(PathBuf::from(new_dir));
};

Expand Down
4 changes: 2 additions & 2 deletions tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{env, path::PathBuf};

use assert_cmd::Command;
use atmpt::{ALWAYS_DELETE_KEY, EDITOR_KEY, TEMPLATE_DIR_KEY};
use atmpt::{ALWAYS_DELETE_KEY, DATA_DIR_KEY, EDITOR_KEY};

const PROJECT_DIR: &str = env!("CARGO_MANIFEST_DIR");

Expand All @@ -10,7 +10,7 @@ fn cmd() -> Command {
env::set_var(ALWAYS_DELETE_KEY, "true");

let templates = PathBuf::from_iter([PROJECT_DIR, "templates"]);
env::set_var(TEMPLATE_DIR_KEY, templates.to_string_lossy().as_ref());
env::set_var(DATA_DIR_KEY, templates.to_string_lossy().as_ref());

Command::cargo_bin("atmpt").unwrap()
}
Expand Down

0 comments on commit 8b5bbba

Please sign in to comment.