MCPcopy Create free account
hub / github.com/PerroEngine/Perro / main

Function main

perro_source/devtools/perro_cli/src/main.rs:47–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46fn log_note(label: &str) {
47 println!("{COLOR_YELLOW}🚀 {label}{COLOR_RESET}");
48}
49
50fn main() {
51 let args: Vec<String> = env::args().collect();
52 let cwd = env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
53
54 let Some(command) = args.get(1).map(String::as_str) else {
55 print_usage();
56 std::process::exit(2);
57 };
58
59 let result = if command == "--help"
60 || command == "-h"
61 || command == "help"
62 || command_help_requested(&args)
63 {
64 print_usage();
65 Ok(())
66 } else if let Err(err) = validate_command_args(command, &args) {
67 Err(err)
68 } else {
69 match command {
70 "new" => new_command(&args, &cwd),
71 "new_dlc" => new_dlc_command(&args, &cwd),
72 "new_script" => new_script_command(&args, &cwd),
73 "new_scene" => new_scene_command(&args, &cwd),
74 "new_animation" => new_animation_command(&args, &cwd),
75 "new_panimtree" => new_panimtree_command(&args, &cwd),
76 "import_anim" | "gltf_to_panim" | "glb_to_panim" => gltf_to_panim_command(&args, &cwd),
77 "clean" => clean_command(&args, &cwd),
78 "install" => install_command(&args),
79 "check" => scripts_command(&args, &cwd),
80 "test" => test_command(&args, &cwd),
81 "build" => project_command(&args, &cwd),
82 "targets" => targets_command(&args),
83 "version" => version::version_command(&args),
84 "dlc" => dlc_command(&args, &cwd),
85 "dev" => dev_command(&args, &cwd),
86 "bench" => bench_command(&args, &cwd),
87 "doctor" => doctor_command(&args, &cwd),
88 "mem-profile" => mem_profile_command(&args, &cwd),
89 "spec" => spec_command(&args, &cwd),
90 "flamegraph" => flamegraph_command(&args, &cwd),
91 "format" => format_command(&args, &cwd),
92 "clippy" => clippy_command(&args, &cwd),
93 _ => {
94 print_usage();
95 Err(format!("unknown command `{command}`"))

Callers

nothing calls this directly

Calls 15

print_usageFunction · 0.85
new_commandFunction · 0.85
new_dlc_commandFunction · 0.85
new_script_commandFunction · 0.85
new_scene_commandFunction · 0.85
new_animation_commandFunction · 0.85
new_panimtree_commandFunction · 0.85
gltf_to_panim_commandFunction · 0.85
clean_commandFunction · 0.85
install_commandFunction · 0.85
scripts_commandFunction · 0.85
test_commandFunction · 0.85

Tested by

no test coverage detected