@@ -32,8 +32,8 @@ impl Cmd {
3232 . ok_or_else ( || anyhow ! ( "The current shell could not be determined. Please specify a shell with the --shell argument." ) ) ?;
3333
3434 match & self . kind {
35- CompleteKind :: Install => {
36- self . install ( shell) ?;
35+ CompleteKind :: Install { manual } => {
36+ self . install ( shell, * manual ) ?;
3737 }
3838 CompleteKind :: ProbeList { input } => {
3939 self . probe_list ( lister, input) ?;
@@ -50,7 +50,7 @@ impl Cmd {
5050 ///
5151 /// If the shell cannot be determined or the auto-install is not implemented yet,
5252 /// the function prints the script with instructions for the user.
53- pub fn install ( & self , shell : Shell ) -> Result < ( ) > {
53+ pub fn install ( & self , shell : Shell , manual : bool ) -> Result < ( ) > {
5454 let mut command = <Cli as CommandFactory >:: command ( ) ;
5555 let path: PathBuf = std:: env:: args_os ( ) . next ( ) . unwrap ( ) . into ( ) ;
5656 let name = path. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
@@ -62,6 +62,11 @@ impl Cmd {
6262
6363 let file_name = shell. file_name ( BIN_NAME ) ;
6464
65+ if manual {
66+ println ! ( "{script}" ) ;
67+ return Ok ( ( ) ) ;
68+ }
69+
6570 match shell {
6671 Shell :: Zsh => {
6772 Zsh . install ( & file_name, & script) ?;
@@ -99,7 +104,14 @@ impl Cmd {
99104#[ clap( verbatim_doc_comment) ]
100105pub enum CompleteKind {
101106 /// Installs the autocomplete script for the correct shell.
102- Install ,
107+ Install {
108+ /// Just print the script to stdout if this flag is active.
109+ ///
110+ /// This is useful for packaging probe-rs for installers that have their
111+ /// own autocomplete packaging mechanisms.
112+ #[ clap( short, long) ]
113+ manual : bool ,
114+ } ,
103115 /// Lists the probes that are currently plugged in in a way that the shell understands.
104116 ProbeList {
105117 /// The already entered user input that will be used to filter the list.
0 commit comments