MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / main

Function main

cli/src/main.rs:70–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68}
69
70fn main() -> Result<()> {
71 let cli = Cli::parse();
72 ui::init(cli.no_color);
73 ctrlc::set_handler(|| std::process::exit(130)).ok();
74
75 let manifest_path = cli.packages.unwrap_or_else(|| PathBuf::from("packages.json"));
76
77 let result = match cli.cmd {
78 Cmd::Init { name, bare } => init::run(name.as_deref(), bare),
79 Cmd::Add { pkgs } => pkg::add(&manifest_path, &pkgs),
80 Cmd::Remove { pkgs } => pkg::remove(&manifest_path, &pkgs),
81 Cmd::Serve { port, open } => serve::run(PathBuf::from("."), port, open),
82 Cmd::Run { file } => run_script(&manifest_path, file.as_deref()),
83 Cmd::Repl => repl::run(&manifest_path),
84 Cmd::Build { out } => build::run(&manifest_path, out.unwrap_or_else(|| PathBuf::from("dist"))),
85 Cmd::Uninstall => uninstall::run(),
86 // Last one standing: needs a `test` module + discovery + reporter on top of the engine.
87 Cmd::Test { .. } => bail!("not wired yet: edge test"),
88 };
89
90 if let Err(e) = result {
91 ui::error(&e);
92 std::process::exit(1);
93 }
94 Ok(())
95}
96
97/// Read a script from `file` (or stdin when absent) and run it; a script that raises exits non-zero.
98fn run_script(manifest_path: &Path, file: Option<&Path>) -> Result<()> {

Callers

nothing calls this directly

Calls 7

initFunction · 0.85
run_scriptFunction · 0.85
errorFunction · 0.85
runFunction · 0.70
addFunction · 0.70
removeFunction · 0.70
parseFunction · 0.50

Tested by

no test coverage detected