Skip to content

Commit de32fbb

Browse files
author
Arjun Balaji
committed
Manually verified git diff origin/main makes sense. Rebased onto main.
1 parent e5b8daf commit de32fbb

File tree

4 files changed

+74
-971
lines changed

4 files changed

+74
-971
lines changed

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ use std::time::{
3737
};
3838

3939
use amzn_codewhisperer_client::types::SubscriptionStatus;
40-
use clap::{Args, CommandFactory, Parser};
40+
use clap::{
41+
Args,
42+
CommandFactory,
43+
Parser,
44+
};
4145
use cli::compact::CompactStrategy;
4246
pub use conversation::ConversationState;
4347
use conversation::TokenWarningLevel;

crates/chat-cli/src/cli/mod.rs

Lines changed: 69 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,50 @@ mod settings;
99
mod user;
1010

1111
use std::fmt::Display;
12-
use std::io::{Write as _, stdout};
12+
use std::io::{
13+
Write as _,
14+
stdout,
15+
};
1316
use std::process::ExitCode;
1417

1518
use agent::AgentArgs;
1619
use anstream::println;
1720
pub use chat::ConversationState;
18-
use clap::{ArgAction, CommandFactory, Parser, Subcommand, ValueEnum};
21+
use clap::{
22+
ArgAction,
23+
CommandFactory,
24+
Parser,
25+
Subcommand,
26+
ValueEnum,
27+
};
1928
use crossterm::style::Stylize;
20-
use eyre::{Result, bail};
29+
use eyre::{
30+
Result,
31+
bail,
32+
};
2133
use feed::Feed;
2234
use serde::Serialize;
23-
use tracing::{Level, debug};
35+
use tracing::{
36+
Level,
37+
debug,
38+
};
2439

2540
use crate::cli::chat::ChatArgs;
2641
use crate::cli::mcp::McpSubcommand;
27-
use crate::cli::user::{LoginArgs, WhoamiArgs};
28-
use crate::logging::{LogArgs, initialize_logging};
42+
use crate::cli::user::{
43+
LoginArgs,
44+
WhoamiArgs,
45+
};
46+
use crate::logging::{
47+
LogArgs,
48+
initialize_logging,
49+
};
2950
use crate::os::Os;
3051
use crate::util::directories::logs_dir;
31-
use crate::util::{CLI_BINARY_NAME, GOV_REGIONS};
52+
use crate::util::{
53+
CLI_BINARY_NAME,
54+
GOV_REGIONS,
55+
};
3256

3357
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, ValueEnum)]
3458
pub enum OutputFormat {
@@ -149,7 +173,6 @@ impl Display for RootSubcommand {
149173
Self::Chat(_) => "chat",
150174
Self::Login(_) => "login",
151175
Self::Logout => "logout",
152-
Self::Agent(_) => "agent",
153176
Self::Whoami(_) => "whoami",
154177
Self::Profile => "profile",
155178
Self::Settings(_) => "settings",
@@ -312,80 +335,59 @@ mod test {
312335
/// Test flag parsing for the top level [Cli]
313336
#[test]
314337
fn test_flags() {
315-
assert_eq!(
316-
Cli::parse_from([CHAT_BINARY_NAME, "-v"]),
317-
Cli {
318-
subcommand: None,
319-
verbose: 1,
320-
help_all: false,
321-
}
322-
);
338+
assert_eq!(Cli::parse_from([CHAT_BINARY_NAME, "-v"]), Cli {
339+
subcommand: None,
340+
verbose: 1,
341+
help_all: false,
342+
});
323343

324-
assert_eq!(
325-
Cli::parse_from([CHAT_BINARY_NAME, "-vvv"]),
326-
Cli {
327-
subcommand: None,
328-
verbose: 3,
329-
help_all: false,
330-
}
331-
);
344+
assert_eq!(Cli::parse_from([CHAT_BINARY_NAME, "-vvv"]), Cli {
345+
subcommand: None,
346+
verbose: 3,
347+
help_all: false,
348+
});
332349

333-
assert_eq!(
334-
Cli::parse_from([CHAT_BINARY_NAME, "--help-all"]),
335-
Cli {
336-
subcommand: None,
337-
verbose: 0,
338-
help_all: true,
339-
}
340-
);
350+
assert_eq!(Cli::parse_from([CHAT_BINARY_NAME, "--help-all"]), Cli {
351+
subcommand: None,
352+
verbose: 0,
353+
help_all: true,
354+
});
341355

342-
assert_eq!(
343-
Cli::parse_from([CHAT_BINARY_NAME, "chat", "-vv"]),
344-
Cli {
345-
subcommand: Some(RootSubcommand::Chat(ChatArgs {
346-
resume: false,
347-
input: None,
348-
agent: None,
349-
model: None,
350-
trust_all_tools: false,
351-
trust_tools: None,
352-
no_interactive: false,
353-
migrate: false,
354-
})),
355-
verbose: 2,
356-
help_all: false,
357-
}
358-
);
356+
assert_eq!(Cli::parse_from([CHAT_BINARY_NAME, "chat", "-vv"]), Cli {
357+
subcommand: Some(RootSubcommand::Chat(ChatArgs {
358+
resume: false,
359+
input: None,
360+
agent: None,
361+
model: None,
362+
trust_all_tools: false,
363+
trust_tools: None,
364+
no_interactive: false,
365+
migrate: false,
366+
})),
367+
verbose: 2,
368+
help_all: false,
369+
});
359370
}
360371

361372
#[test]
362373
fn test_version_changelog() {
363-
assert_parse!(
364-
["version", "--changelog"],
365-
RootSubcommand::Version {
366-
changelog: Some("".to_string()),
367-
}
368-
);
374+
assert_parse!(["version", "--changelog"], RootSubcommand::Version {
375+
changelog: Some("".to_string()),
376+
});
369377
}
370378

371379
#[test]
372380
fn test_version_changelog_all() {
373-
assert_parse!(
374-
["version", "--changelog=all"],
375-
RootSubcommand::Version {
376-
changelog: Some("all".to_string()),
377-
}
378-
);
381+
assert_parse!(["version", "--changelog=all"], RootSubcommand::Version {
382+
changelog: Some("all".to_string()),
383+
});
379384
}
380385

381386
#[test]
382387
fn test_version_changelog_specific() {
383-
assert_parse!(
384-
["version", "--changelog=1.8.0"],
385-
RootSubcommand::Version {
386-
changelog: Some("1.8.0".to_string()),
387-
}
388-
);
388+
assert_parse!(["version", "--changelog=1.8.0"], RootSubcommand::Version {
389+
changelog: Some("1.8.0".to_string()),
390+
});
389391
}
390392

391393
#[test]

crates/q_cli/Cargo.toml

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)