Skip to content

Commit

Permalink
feat(cli/config): link lib on config create
Browse files Browse the repository at this point in the history
  • Loading branch information
comfysage committed Jan 22, 2024
1 parent 20d8e12 commit 15f9f48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions saku-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use saku_lib::exec;
use saku_lib::pkg;
use saku_lib::pkg::config::Config;
use saku_lib::prelude::*;
use saku_lib::util::filepath;
use saku_lib::util::{constants, io, msg, path};

use crate::{flask, update};
Expand All @@ -24,6 +25,14 @@ pub fn init() -> Result<()> {

io::mkdir(constants::FLASK_DIR.to_string())?;

if !filepath::exists(&*constants::LIB_DIR) {
let repo_dir: String = path::repo("saku");
let lib_dir: String = constants::LIB_DIR_NAME.to_string();
dbg!(&repo_dir, &lib_dir);
let target = filepath::join(&repo_dir, &lib_dir);
io::link(&target, &*constants::LIB_DIR)?;
}

create_root()?;

io::mkdir(path::gr("custom"))?;
Expand Down
3 changes: 2 additions & 1 deletion saku-lib/util/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ lazy_static! {
pub static ref PKG_DIR: String = format!("{}{}", *SAKU_DIR, "/flask");
pub static ref ROOT_DIR: String = format!("{}{}", *SAKU_DIR, "/root");
pub static ref STORE_DIR: String = format!("{}{}", *SAKU_DIR, "/store");
pub static ref LIB_DIR: String = format!("{}{}", *SAKU_DIR, "/lib");
pub static ref LIB_DIR_NAME: String = "lib".to_string();
pub static ref LIB_DIR: String = format!("{}/{}", *SAKU_DIR, *LIB_DIR_NAME);

pub static ref FLASK_DIR_NAME: String = "flasks".to_string();
pub static ref FLASK_DIR: String = format!("{}/{}", *PKG_DIR, *FLASK_DIR_NAME);
Expand Down

0 comments on commit 15f9f48

Please sign in to comment.