rename sc2 to sci and move old dev-part stuff into the c2vi part
This commit is contained in:
30
marts/src/sci/mod.rs
Normal file
30
marts/src/sci/mod.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
use mize::*;
|
||||
pub mod timetrack;
|
||||
|
||||
pub fn part_sci(mize: &mut Mize) -> MizeResult<()> {
|
||||
part_add_thought(mize)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn part_add_thought(mize: &mut Mize) -> MizeResult<()> {
|
||||
use marts::generated::spacetime::add_thought;
|
||||
let mut cli = mize.get_part_native::<marts::CliPart>("cli")?;
|
||||
cli.set_command("sci");
|
||||
cli.subcommand(Command::new("inputThought").alias("ti"), |matches, mut mize| {
|
||||
|
||||
let tmp_file = std::env::temp_dir().join(format!(
|
||||
"sc2-input-thought-{}.txt",
|
||||
chrono::Utc::now().timestamp()
|
||||
));
|
||||
marts::cli_spawn(format!("nvim {}", tmp_file.display()))?;
|
||||
let new_file_content = std::fs::read_to_string(&tmp_file)
|
||||
.map_err(|e| mize_err!("Failed to read temp file: {}", e))?;
|
||||
let _ = std::fs::remove_file(&tmp_file);
|
||||
let spacetime = mize.get_part_native::<marts::SpacetimePart>("spacetime")?;
|
||||
spacetime.con().reducers.add_thought(new_file_content)?;
|
||||
Ok(())
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user