@@ -19,22 +19,42 @@ pub enum ProfileSubcommand {
1919 Delete { name : String } ,
2020 Set { name : String } ,
2121 Rename { old_name : String , new_name : String } ,
22+ Help ,
2223}
2324
2425impl ProfileSubcommand {
25- const CREATE_USAGE : & str = "/profile create profile_name" ;
26- const DELETE_USAGE : & str = "/profile delete profile_name" ;
27- const RENAME_USAGE : & str = "/profile rename old_profile_name new_profile_name" ;
28- const SET_USAGE : & str = "/profile set profile_name" ;
26+ const AVAILABLE_COMMANDS : & str = color_print:: cstr! { "<cyan!>Available commands</cyan!>
27+ <em>help</em> <black!>Show an explanation for the profile command</black!>
28+ <em>list</em> <black!>List all available profiles</black!>
29+ <em>create <<name>></em> <black!>Create a new profile with the specified name</black!>
30+ <em>delete <<name>></em> <black!>Delete the specified profile</black!>
31+ <em>set <<name>></em> <black!>Switch to the specified profile</black!>
32+ <em>rename <<old>> <<new>></em> <black!>Rename a profile</black!>" } ;
33+ const CREATE_USAGE : & str = "/profile create <profile_name>" ;
34+ const DELETE_USAGE : & str = "/profile delete <profile_name>" ;
35+ const RENAME_USAGE : & str = "/profile rename <old_profile_name> <new_profile_name>" ;
36+ const SET_USAGE : & str = "/profile set <profile_name>" ;
2937
3038 fn usage_msg ( header : impl AsRef < str > ) -> String {
31- format ! (
32- "{}\n \n Usage:\n {}\n {}\n {}\n {}" ,
33- header. as_ref( ) ,
34- ProfileSubcommand :: CREATE_USAGE ,
35- ProfileSubcommand :: DELETE_USAGE ,
36- ProfileSubcommand :: RENAME_USAGE ,
37- ProfileSubcommand :: SET_USAGE
39+ format ! ( "{}\n \n {}" , header. as_ref( ) , Self :: AVAILABLE_COMMANDS )
40+ }
41+
42+ pub fn help_text ( ) -> String {
43+ color_print:: cformat!(
44+ r#"
45+ <magenta,em>Profile Management</magenta,em>
46+
47+ Profiles allow you to organize and manage different sets of context files for different projects or tasks.
48+
49+ {}
50+
51+ <cyan!>Notes</cyan!>
52+ • The "global" profile contains context files that are available in all profiles
53+ • The "default" profile is used when no profile is specified
54+ • You can switch between profiles to work on different projects
55+ • Each profile maintains its own set of context files
56+ "# ,
57+ Self :: AVAILABLE_COMMANDS
3858 )
3959 }
4060}
@@ -56,22 +76,51 @@ pub enum ContextSubcommand {
5676 Clear {
5777 global : bool ,
5878 } ,
79+ Help ,
5980}
6081
6182impl ContextSubcommand {
62- const ADD_USAGE : & str = "/context add [--global] [--force] path1 [path2...]" ;
83+ const ADD_USAGE : & str = "/context add [--global] [--force] <path1> [path2...]" ;
84+ const AVAILABLE_COMMANDS : & str = color_print:: cstr! { "<cyan!>Available commands</cyan!>
85+ <em>help</em> <black!>Show an explanation for the context command</black!>
86+ <em>show [--expand]</em> <black!>Display current context configuration</black!>
87+ <black!>Use --expand to list all matched files</black!>
88+
89+ <em>add [--global] [--force] <<paths...>></em>
90+ <black!>Add file(s) to context</black!>
91+ <black!>--global: Add to global context (available in all profiles)</black!>
92+ <black!>--force: Add files even if they exceed size limits</black!>
93+
94+ <em>rm [--global] <<paths...>></em> <black!>Remove file(s) from context</black!>
95+ <black!>--global: Remove from global context</black!>
96+
97+ <em>clear [--global]</em> <black!>Clear all files from current context</black!>
98+ <black!>--global: Clear global context</black!>" } ;
6399 const CLEAR_USAGE : & str = "/context clear [--global]" ;
64- const REMOVE_USAGE : & str = "/context rm [--global] path1 [path2...]" ;
100+ const REMOVE_USAGE : & str = "/context rm [--global] < path1> [path2...]" ;
65101 const SHOW_USAGE : & str = "/context show [--expand]" ;
66102
67103 fn usage_msg ( header : impl AsRef < str > ) -> String {
68- format ! (
69- "{}\n \n Usage:\n {}\n {}\n {}\n {}" ,
70- header. as_ref( ) ,
71- ContextSubcommand :: SHOW_USAGE ,
72- ContextSubcommand :: ADD_USAGE ,
73- ContextSubcommand :: REMOVE_USAGE ,
74- ContextSubcommand :: CLEAR_USAGE
104+ format ! ( "{}\n \n {}" , header. as_ref( ) , Self :: AVAILABLE_COMMANDS )
105+ }
106+
107+ pub fn help_text ( ) -> String {
108+ color_print:: cformat!(
109+ r#"
110+ <magenta,em>Context Management</magenta,em>
111+
112+ Context files provide Amazon Q with additional information about your project or environment.
113+ Adding relevant files to your context helps Amazon Q provide more accurate and helpful responses.
114+
115+ {}
116+
117+ <cyan!>Notes</cyan!>
118+ • You can add specific files or use glob patterns (e.g., "*.py", "src/**/*.js")
119+ • Context files are associated with the current profile
120+ • Global context files are available across all profiles
121+ • Context is preserved between chat sessions
122+ "# ,
123+ Self :: AVAILABLE_COMMANDS
75124 )
76125 }
77126}
@@ -100,7 +149,7 @@ impl Command {
100149 macro_rules! usage_err {
101150 ( $usage_str: expr) => {
102151 return Err ( format!(
103- "Invalid /profile arguments.\n \n Usage:\n {}" ,
152+ "Invalid /profile arguments.\n \n Usage:\n {}" ,
104153 $usage_str
105154 ) )
106155 } ;
@@ -156,6 +205,9 @@ impl Command {
156205 None => usage_err ! ( ProfileSubcommand :: SET_USAGE ) ,
157206 }
158207 } ,
208+ "help" => Self :: Profile {
209+ subcommand : ProfileSubcommand :: Help ,
210+ } ,
159211 other => {
160212 return Err ( ProfileSubcommand :: usage_msg ( format ! ( "Unknown subcommand '{}'." , other) ) ) ;
161213 } ,
@@ -169,7 +221,7 @@ impl Command {
169221 macro_rules! usage_err {
170222 ( $usage_str: expr) => {
171223 return Err ( format!(
172- "Invalid /context arguments.\n \n Usage:\n {}" ,
224+ "Invalid /context arguments.\n \n Usage:\n {}" ,
173225 $usage_str
174226 ) )
175227 } ;
@@ -253,6 +305,9 @@ impl Command {
253305 subcommand : ContextSubcommand :: Clear { global } ,
254306 }
255307 } ,
308+ "help" => Self :: Context {
309+ subcommand : ContextSubcommand :: Help ,
310+ } ,
256311 other => {
257312 return Err ( ContextSubcommand :: usage_msg ( format ! ( "Unknown subcommand '{}'." , other) ) ) ;
258313 } ,
0 commit comments