@@ -70,7 +70,9 @@ Profiles allow you to organize and manage different sets of context files for di
70
70
71
71
#[ derive( Debug , Clone , PartialEq , Eq ) ]
72
72
pub enum ContextSubcommand {
73
- Show ,
73
+ Show {
74
+ expand : bool ,
75
+ } ,
74
76
Add {
75
77
global : bool ,
76
78
force : bool ,
@@ -91,7 +93,8 @@ impl ContextSubcommand {
91
93
const AVAILABLE_COMMANDS : & str = color_print:: cstr! { "<cyan!>Available commands</cyan!>
92
94
<em>help</em> <black!>Show an explanation for the context command</black!>
93
95
94
- <em>show</em> <black!>Display the context rule configuration and matched files</black!>
96
+ <em>show [--expand]</em> <black!>Display the context rule configuration and matched files</black!>
97
+ <black!>--expand: Print out each matched file's content</black!>
95
98
96
99
<em>add [--global] [--force] <<paths...>></em>
97
100
<black!>Add context rules (filenames or glob patterns)</black!>
@@ -105,6 +108,7 @@ impl ContextSubcommand {
105
108
<black!>--global: Remove global rules</black!>" } ;
106
109
const CLEAR_USAGE : & str = "/context clear [--global]" ;
107
110
const REMOVE_USAGE : & str = "/context rm [--global] <path1> [path2...]" ;
111
+ const SHOW_USAGE : & str = "/context show [--expand]" ;
108
112
109
113
fn usage_msg ( header : impl AsRef < str > ) -> String {
110
114
format ! ( "{}\n \n {}" , header. as_ref( ) , Self :: AVAILABLE_COMMANDS )
@@ -340,8 +344,18 @@ impl Command {
340
344
}
341
345
342
346
match parts[ 1 ] . to_lowercase ( ) . as_str ( ) {
343
- "show" => Self :: Context {
344
- subcommand : ContextSubcommand :: Show ,
347
+ "show" => {
348
+ let mut expand = false ;
349
+ for part in & parts[ 2 ..] {
350
+ if * part == "--expand" {
351
+ expand = true ;
352
+ } else {
353
+ usage_err ! ( ContextSubcommand :: SHOW_USAGE ) ;
354
+ }
355
+ }
356
+ Self :: Context {
357
+ subcommand : ContextSubcommand :: Show { expand } ,
358
+ }
345
359
} ,
346
360
"add" => {
347
361
// Parse add command with paths and flags
@@ -532,7 +546,11 @@ mod tests {
532
546
"/profile set p" ,
533
547
profile ! ( ProfileSubcommand :: Set { name: "p" . to_string( ) } ) ,
534
548
) ,
535
- ( "/context show" , context ! ( ContextSubcommand :: Show ) ) ,
549
+ ( "/context show" , context ! ( ContextSubcommand :: Show { expand: false } ) ) ,
550
+ (
551
+ "/context show --expand" ,
552
+ context ! ( ContextSubcommand :: Show { expand: true } ) ,
553
+ ) ,
536
554
(
537
555
"/context add p1 p2" ,
538
556
context ! ( ContextSubcommand :: Add {
0 commit comments