This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if response.to_lowercase() == String::from("e") { | |
| let editor = var("EDITOR"); | |
| Command::new({ | |
| if cfg!(windows) { | |
| "cmd" | |
| } else { | |
| "/usr/bin/bash" | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| } else if response.to_lowercase() == "s" { | |
| make_dir(&PathBuf::from(flag_path.parent().unwrap()), false); | |
| println!("\nFlag to set:"); | |
| let mut flag = String::new(); | |
| capture_input(&mut flag); | |
| match write(CONFIG.dir_root.join(&flag_path), flag) { | |
| Err(E) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use confy::{get_configuration_file_path, ConfyError}; | |
| use dirs::home_dir; | |
| use serde::{Deserialize, Serialize}; | |
| use std::io::Read; | |
| use std::path::{Path, PathBuf}; | |
| use std::process::exit; | |
| use once_cell::sync::Lazy; | |
| #[derive(Debug, Deserialize, Serialize)] | |
| struct MyConfig { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| key_dir=""; | |
| # config_dir=; # I'll hold off on implementing that for now | |
| if [ "$(command ls ~/.cache/overthewire/config)" == "$(echo ~/.cache/overthewire/config)" ]; then | |
| key_dir=$(cat /home/${USER}/.cache/overthewire/config); | |
| fi | |
| if [ "${key_dir}" == "" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use confy::{get_configuration_file_path, ConfyError}; | |
| use dirs::home_dir; | |
| use serde::{Deserialize, Serialize}; | |
| use std::io::Read; | |
| use std::path::{Path, PathBuf}; | |
| #[derive(Debug, Deserialize, Serialize)] | |
| struct MyConfig { | |
| max_level: usize, | |
| dir_root: PathBuf, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [package] | |
| name = "rust-rewrite" | |
| version = "0.1.0" | |
| edition = "2021" | |
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
| [dependencies] | |
| confy = "0.5.1" | |
| dirs = "4.0.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use confy::{get_configuration_file_path, ConfyError}; | |
| use dirs::home_dir; | |
| use serde::{Deserialize, Serialize}; | |
| use std::io::Read; | |
| use std::path::{Path, PathBuf}; | |
| #[derive(Debug, Deserialize, Serialize)] | |
| struct MyConfig { | |
| max_level: usize, | |
| dir_root: PathBuf, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::io::Read; | |
| use std::path::{Path, PathBuf}; | |
| use dirs::home_dir; | |
| use serde_derive::{Serialize, Deserialize}; | |
| use confy::get_configuration_file_path; | |
| #[derive(Debug, Serialize, Deserialize)] | |
| struct MyConfig { | |
| max_level: usize, | |
| dir_root: PathBuf |
NewerOlder