@@ -18,7 +18,6 @@ use utils::types::{LogLevel, Spy};
1818 long_about = "Pyroscope CLI" ,
1919 version
2020) ]
21- #[ clap( setting = AppSettings :: SubcommandRequired ) ]
2221#[ clap( global_setting( AppSettings :: DeriveDisplayOrder ) ) ]
2322pub struct Cli {
2423 /// Set a custom config file
@@ -67,7 +66,8 @@ enum Commands {
6766 name = "detect_subprocesses" ,
6867 long = "detect-subprocesses" ,
6968 value_name = "DECTECT_SUBPROCESSES" ,
70- help = "keep track of and profile subprocesses of the main process"
69+ help = "keep track of and profile subprocesses of the main process" ,
70+ takes_value = false
7171 ) ]
7272 detect_subprocesses : bool ,
7373 #[ clap(
@@ -83,7 +83,8 @@ enum Commands {
8383 name = "no_logging" ,
8484 long = "no-logging" ,
8585 value_name = "NO_LOGGING" ,
86- help = "disable logging from pyroscope"
86+ help = "disable logging from pyroscope" ,
87+ takes_value = false
8788 ) ]
8889 no_logging : bool ,
8990 #[ clap(
@@ -98,35 +99,40 @@ enum Commands {
9899 name = "rbspy_blocking" ,
99100 long = "rbspy-blocking" ,
100101 value_name = "RBSPY_BLOCKING" ,
101- help = "enable blocking mode for rbspy"
102+ help = "enable blocking mode for rbspy" ,
103+ takes_value = false
102104 ) ]
103105 rbspy_blocking : bool ,
104106 #[ clap(
105107 name = "pyspy_blocking" ,
106108 long = "pyspy-blocking" ,
107109 value_name = "PYSPY_BLOCKING" ,
108- help = "enable blocking mode for pyspy"
110+ help = "enable blocking mode for pyspy" ,
111+ takes_value = false
109112 ) ]
110113 pyspy_blocking : bool ,
111114 #[ clap(
112115 name = "pyspy_idle" ,
113116 long = "pyspy-idle" ,
114117 value_name = "PYSPY_IDLE" ,
115- help = "include idle threads for pyspy"
118+ help = "include idle threads for pyspy" ,
119+ takes_value = false
116120 ) ]
117121 pyspy_idle : bool ,
118122 #[ clap(
119123 name = "pyspy_gil" ,
120124 long = "pyspy-gil" ,
121125 value_name = "PYSPY_GIL" ,
122- help = "enable GIL mode for pyspy"
126+ help = "enable GIL mode for pyspy" ,
127+ takes_value = false
123128 ) ]
124129 pyspy_gil : bool ,
125130 #[ clap(
126131 name = "pyspy_native" ,
127132 long = "pyspy-native" ,
128133 value_name = "PYSPY_NATIVE" ,
129- help = "enable native extensions profiling for pyspy"
134+ help = "enable native extensions profiling for pyspy" ,
135+ takes_value = false
130136 ) ]
131137 pyspy_native : bool ,
132138 #[ clap(
@@ -152,7 +158,7 @@ enum Commands {
152158 ) ]
153159 spy_name : Spy ,
154160 #[ clap(
155- multiple = true ,
161+ multiple_occurrences = true ,
156162 name = "tag" ,
157163 long = "tag" ,
158164 value_name = "TAG" ,
@@ -206,7 +212,8 @@ enum Commands {
206212 name = "detect_subprocesses" ,
207213 long = "detect-subprocesses" ,
208214 value_name = "DECTECT_SUBPROCESSES" ,
209- help = "keep track of and profile subprocesses of the main process"
215+ help = "keep track of and profile subprocesses of the main process" ,
216+ takes_value = false
210217 ) ]
211218 detect_subprocesses : bool ,
212219 #[ clap(
@@ -222,7 +229,8 @@ enum Commands {
222229 name = "no_logging" ,
223230 long = "no-logging" ,
224231 value_name = "NO_LOGGING" ,
225- help = "disable logging from pyroscope"
232+ help = "disable logging from pyroscope" ,
233+ takes_value = false
226234 ) ]
227235 no_logging : bool ,
228236 //#[clap(
@@ -236,35 +244,40 @@ enum Commands {
236244 name = "rbspy_blocking" ,
237245 long = "rbspy-blocking" ,
238246 value_name = "RBSPY_BLOCKING" ,
239- help = "enable blocking mode for rbspy"
247+ help = "enable blocking mode for rbspy" ,
248+ takes_value = false
240249 ) ]
241250 rbspy_blocking : bool ,
242251 #[ clap(
243252 name = "pyspy_blocking" ,
244253 long = "pyspy-blocking" ,
245254 value_name = "PYSPY_BLOCKING" ,
246- help = "enable blocking mode for pyspy"
255+ help = "enable blocking mode for pyspy" ,
256+ takes_value = false
247257 ) ]
248258 pyspy_blocking : bool ,
249259 #[ clap(
250260 name = "pyspy_idle" ,
251261 long = "pyspy-idle" ,
252262 value_name = "PYSPY_IDLE" ,
253- help = "include idle threads for pyspy"
263+ help = "include idle threads for pyspy" ,
264+ takes_value = false
254265 ) ]
255266 pyspy_idle : bool ,
256267 #[ clap(
257268 name = "pyspy_gil" ,
258269 long = "pyspy-gil" ,
259270 value_name = "PYSPY_GIL" ,
260- help = "enable GIL mode for pyspy"
271+ help = "enable GIL mode for pyspy" ,
272+ takes_value = false
261273 ) ]
262274 pyspy_gil : bool ,
263275 #[ clap(
264276 name = "pyspy_native" ,
265277 long = "pyspy-native" ,
266278 value_name = "PYSPY_NATIVE" ,
267- help = "enable native extensions profiling for pyspy"
279+ help = "enable native extensions profiling for pyspy" ,
280+ takes_value = false
268281 ) ]
269282 pyspy_native : bool ,
270283 #[ clap(
@@ -329,12 +342,6 @@ enum Commands {
329342 ) ]
330343 group_name : Option < String > ,
331344 } ,
332- #[ clap(
333- name = "config" ,
334- about = "Show Configuration" ,
335- long_about = None ,
336- ) ]
337- Config ,
338345}
339346
340347/// Supported Completion Shells
@@ -358,12 +365,12 @@ pub fn cli_match() -> Result<()> {
358365 // Merge clap config file if the value is set
359366 AppConfig :: merge_config ( cli. config . as_deref ( ) ) ?;
360367
361- let app = Cli :: into_app ( ) ;
368+ let app = Cli :: command ( ) ;
362369
363370 // Merge clap args into config
364371 AppConfig :: merge_args ( app) ?;
365372
366- let mut app = Cli :: into_app ( ) ;
373+ let mut app = Cli :: command ( ) ;
367374 // Execute the subcommand
368375 match & cli. command {
369376 Commands :: Exec { .. } => {
@@ -391,9 +398,6 @@ pub fn cli_match() -> Result<()> {
391398 generate ( Zsh , & mut app, "pyroscope-cli" , & mut std:: io:: stdout ( ) ) ;
392399 }
393400 } ,
394- Commands :: Config => {
395- commands:: config ( ) ?;
396- }
397401 }
398402
399403 Ok ( ( ) )
0 commit comments