MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / main

Function main

atomic-cli/src/main.rs:854–980  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

852// Main Entry Point
853
854fn main() {
855 // Initialize logging
856 env_logger::init();
857
858 // Parse command-line arguments through the agent-native help layout.
859 //
860 // `try_get_matches_from_mut` rather than `get_matches`: clap's own failure
861 // output is human prose ending in "For more information, try '--help'",
862 // which costs an agent a second round trip and may discard the option/value
863 // relationship or the parser's underlying cause. We intercept and re-render
864 // in the same `key: value` dialect the rest of the machine surface speaks.
865 // Help and version still print through clap untouched.
866 let mut cmd = apply_agent_help(Cli::command());
867 let args: Vec<std::ffi::OsString> = std::env::args_os().collect();
868 let matches = match cmd.try_get_matches_from_mut(args.clone()) {
869 Ok(matches) => matches,
870 Err(err) => agent_error::render_and_exit(err, &cmd, &args),
871 };
872 let cli = match Cli::from_arg_matches(&matches) {
873 Ok(cli) => cli,
874 Err(err) => agent_error::render_and_exit(err, &cmd, &args),
875 };
876
877 // Configure color output
878 if cli.no_color {
879 // Disable colors globally
880 console::set_colors_enabled(false);
881 console::set_colors_enabled_stderr(false);
882 }
883
884 // Execute the command and handle errors
885 let result = match cli.command {
886 Commands::Agent(agent) => agent.run(),
887
888 Commands::Init(init) => init.run(),
889
890 Commands::Status(status) => status.run(),
891
892 Commands::Add(add) => add.run(),
893
894 Commands::Remove(remove) => remove.run(),
895
896 Commands::Move(mv) => mv.run(),
897
898 Commands::Restore(restore) => restore.run(),
899
900 Commands::Sandbox(sandbox) => sandbox.run(),
901
902 Commands::Session(session) => session.run(),
903
904 Commands::Split(split) => split.run(),
905
906 Commands::Record(record) => record.run(),
907
908 Commands::Revise(revise) => revise.run(),
909
910 Commands::Log(log) => log.run(),
911

Callers

nothing calls this directly

Calls 8

apply_agent_helpFunction · 0.85
commandFunction · 0.85
render_and_exitFunction · 0.85
print_errorFunction · 0.85
cloneMethod · 0.45
runMethod · 0.45
suggestionMethod · 0.45
exit_codeMethod · 0.45

Tested by

no test coverage detected