did some refinement on the client/server protocol
This commit is contained in:
1 parent
283a336643
commit
ae91cc0ce4
6 files changed
+1341
-352
No files matched your search
@@ -9,6 +9,26 @@ use std::process::exit;
|
||||
use tetanus::funcs::get_user_input;
|
||||
|
||||
pub fn install() -> Result<(), Box<dyn Error>> {
|
||||
let client = get_user_input("would you like to install the Tetanus client on this computer?")?
|
||||
.contains("y");
|
||||
let server = get_user_input("would you like to install the Tetanus server on this computer?")?
|
||||
.contains("y");
|
||||
if client {
|
||||
client_install()?;
|
||||
}
|
||||
if server {
|
||||
println!("todo");
|
||||
}
|
||||
if !client && !server {
|
||||
println!(
|
||||
"no install selected, please answer y to one or both of the above prompts next time!"
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
pub fn client_install() -> Result<(), Box<dyn Error>> {
|
||||
if let Some(homedir) = env::home_dir() {
|
||||
let mut config_path = homedir.clone();
|
||||
config_path.push(".config/tetanus");
|
||||
@@ -40,6 +60,15 @@ pub fn install() -> Result<(), Box<dyn Error>> {
|
||||
let template_box = get_user_input(
|
||||
"enter the name of your template distrobox, NONE in all caps if you are not using distrobox",
|
||||
)?;
|
||||
println!(
|
||||
"enter the command used to launch your terminal while running a command. Put the place holder |||COMMAND||| where the command would go"
|
||||
);
|
||||
println!(
|
||||
"if you use a profile to launch the distroboxes, and that profile needs the box name as an environment variable put ENV_NAME= then the name of the variable you use at the end of the command"
|
||||
);
|
||||
let term_cmd = get_user_input(
|
||||
"for example: konsole -e |||COMMAND||| or konsole --profile profile_name ENV_NAME=CURRENT_PROJECT_BOX",
|
||||
)?;
|
||||
config_path.push("client.conf");
|
||||
projects_path.push("default");
|
||||
create_dir_all(&projects_path)?;
|
||||
@@ -70,6 +99,7 @@ pub fn install() -> Result<(), Box<dyn Error>> {
|
||||
.write(format!("upcoming_notes: {}\n", upcoming_notes_path.display()).as_bytes())?;
|
||||
client_config_file.write(format!("module_path: {}\n", module_path.display()).as_bytes())?;
|
||||
client_config_file.write(format!("template_box: {}\n", template_box).as_bytes())?;
|
||||
client_config_file.write(format!("term_cmd: {}\n", term_cmd).as_bytes())?;
|
||||
println!("\ndefault config files written!");
|
||||
println!("downloading default notes and modules...");
|
||||
create_dir_all("./temp")?;
|
||||
|
||||
Reference in new issue
Block a user