MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / execute

Method execute

crates/chat-cli/src/cli/mod.rs:143–178  ·  view source on GitHub ↗
(self, os: &mut Os)

Source from the content-addressed store, hash-verified

141 }
142
143 pub async fn execute(self, os: &mut Os) -> Result<ExitCode> {
144 // Check for auth on subcommands that require it.
145 if self.requires_auth() && !crate::auth::is_logged_in(&mut os.database).await {
146 bail!(
147 "You are not logged in, please log in with {}",
148 StyledText::command(&format!("{CLI_BINARY_NAME} login"))
149 );
150 }
151
152 // Daily heartbeat check
153 if os.database.should_send_heartbeat() && os.telemetry.send_daily_heartbeat().is_ok() {
154 os.database.record_heartbeat_sent().ok();
155 }
156
157 // Send executed telemetry.
158 if self.valid_for_telemetry() {
159 os.telemetry
160 .send_cli_subcommand_executed(&os.database, &self)
161 .await
162 .ok();
163 }
164
165 match self {
166 Self::Agent(args) => args.execute(os).await,
167 Self::Diagnostic(args) => args.execute(os).await,
168 Self::Login(args) => args.execute(os).await,
169 Self::Logout => user::logout(os).await,
170 Self::Whoami(args) => args.execute(os).await,
171 Self::Profile => user::profile(os).await,
172 Self::Settings(settings_args) => settings_args.execute(os).await,
173 Self::Issue(args) => args.execute(os).await,
174 Self::Version { changelog } => Cli::print_version(changelog),
175 Self::Chat(args) => args.execute(os).await,
176 Self::Mcp(args) => args.execute(os, &mut std::io::stderr()).await,
177 }
178 }
179}
180
181impl Default for RootSubcommand {

Callers 5

mainFunction · 0.45
migrateMethod · 0.45
set_entryMethod · 0.45
delete_entryMethod · 0.45
newMethod · 0.45

Calls 15

is_logged_inFunction · 0.85
profileFunction · 0.85
initialize_loggingFunction · 0.85
is_log_stdout_enabledFunction · 0.85
logs_dirFunction · 0.85
get_aws_regionFunction · 0.85
requires_authMethod · 0.80
should_send_heartbeatMethod · 0.80
send_daily_heartbeatMethod · 0.80
record_heartbeat_sentMethod · 0.80
valid_for_telemetryMethod · 0.80

Tested by

no test coverage detected