diff --git a/.cargo/config.toml b/.cargo/config.toml index dc7a348..11db68a 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -4,11 +4,12 @@ br = "build --release" c = "check" t = "test" r = "run" +i = "install --path ." rr = "run --release" w = "clippy -- -D warnings" recursive_example = "rr --example recursions" space_example = ["run", "--release", "--", "\"command list\""] [future-incompat-report] -frequency = 'always' # when to display a notification about a future incompat report +frequency = 'always' # When to display a notification about a future incompatible report diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..8e17422 --- /dev/null +++ b/install.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +if ! command -v rustc +then + echo "Rust is not installed. Please install Rust first." + exit 1 +fi + +if ! command -V cargo +then + echo "cargo is not installed. Please install cargo first." + exit 1 +fi + +SHELL_NAME=$(basename "$SHELL") + +if [ "$SHELL_NAME" = "zsh" ]; then + CONFIG_FILE="$HOME/.zshrc" +elif [ "$SHELL_NAME" = "bash" ]; then + CONFIG_FILE="$HOME/.bashrc" +else + echo "Unknown Shell : $SHELL_NAME" + exit 1 +fi + +echo export PATH=$PATH:~/.cargo/bin/ >> "$CONFIG_FILE" +echo export NYX=$(pwd) >> "$CONFIG_FILE" +echo "NYX env var successfully added" + +cargo br +cargo i + +source "$CONFIG_FILE" + +echo "NYX has been successfully installed." diff --git a/src/nxfs/config.rs b/src/nxfs/config.rs index 49c090f..4598f6d 100644 --- a/src/nxfs/config.rs +++ b/src/nxfs/config.rs @@ -111,7 +111,7 @@ pub struct ConfigSecure { fn config_template() -> &'static str { (r"[config] format = 'nxs_config' -version = '0.4.0' +version = '0.4.1' [user] name = '' @@ -136,12 +136,11 @@ logs = '' cache = '' [security] -secure_mode = false +secure_mode = true ") as _ } pub fn config_command() { - change_work_dir(&utils::env::get_nyx_env_var()); let args: Vec = env::args().collect(); if args.len() <= 2 { command_usage(config_help()); @@ -158,6 +157,7 @@ pub fn config_command() { } fn init_config() { + change_work_dir(&utils::env::get_nyx_env_var()); let config_path = ".nxfs/config.toml"; let mut config_file = match File::create_new(config_path) { Ok(f) => f,