add:build script

This commit is contained in:
kokopi-dev
2026-04-04 23:21:53 +09:00
parent 07a71e4650
commit 2e00f08557
3 changed files with 72 additions and 27 deletions

View File

@@ -1,9 +1,7 @@
use std::{
os::unix::fs,
path::PathBuf,
};
use std::os::unix::fs;
use std::path::PathBuf;
use cliclack::{confirm, input, log, note, select};
use cliclack::{confirm, input, log, note};
use crate::{
config::types::ScriptEntry,
@@ -12,28 +10,7 @@ use crate::{
shim::template::write_shim,
};
#[derive(Clone, Eq, PartialEq)]
enum AddMode {
Existing,
Create,
}
pub fn run(store: &ServiceStore) -> Result<(), AppError> {
let mode = select("What would you like to do?")
.item(AddMode::Existing, "Add existing script", "register a script that already exists")
.item(AddMode::Create, "Create new script", "scaffold a new script from a template")
.interact()?;
match mode {
AddMode::Existing => add_existing(store),
AddMode::Create => {
log::info("Create new script — coming soon.")?;
Ok(())
}
}
}
fn add_existing(store: &ServiceStore) -> Result<(), AppError> {
let config = store.config.load()?;
// ── 1. Path to the original script ────────────────────────────────────────