@@ -129,6 +129,12 @@ pub fn cli() -> App<'static, 'static> {
129
129
. short ( "q" )
130
130
. long ( "quiet" ) ,
131
131
)
132
+ . arg (
133
+ Arg :: with_name ( "toolchain" )
134
+ . help ( TOOLCHAIN_ARG_HELP )
135
+ . long ( "toolchain" )
136
+ . takes_value ( true ) ,
137
+ )
132
138
. subcommand (
133
139
SubCommand :: with_name ( "dump-testament" )
134
140
. about ( "Dump information about the build" )
@@ -467,7 +473,13 @@ pub fn cli() -> App<'static, 'static> {
467
473
. subcommand (
468
474
SubCommand :: with_name ( "which" )
469
475
. about ( "Display which binary will be run for a given command" )
470
- . arg ( Arg :: with_name ( "command" ) . required ( true ) ) ,
476
+ . arg ( Arg :: with_name ( "command" ) . required ( true ) )
477
+ . arg (
478
+ Arg :: with_name ( "toolchain" )
479
+ . help ( TOOLCHAIN_ARG_HELP )
480
+ . long ( "toolchain" )
481
+ . takes_value ( true ) ,
482
+ ) ,
471
483
)
472
484
. subcommand (
473
485
SubCommand :: with_name ( "doc" )
@@ -807,10 +819,15 @@ fn run(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
807
819
808
820
fn which ( cfg : & Cfg , m : & ArgMatches < ' _ > ) -> Result < ( ) > {
809
821
let binary = m. value_of ( "command" ) . expect ( "" ) ;
810
-
811
- let binary_path = cfg
812
- . which_binary ( & utils:: current_dir ( ) ?, binary) ?
813
- . expect ( "binary not found" ) ;
822
+ let toolchain_provided = m. is_present ( "toolchain" ) ;
823
+ let binary_path = if toolchain_provided {
824
+ let toolchain = m. value_of ( "toolchain" ) . expect ( "" ) ;
825
+ cfg. which_binary_by_toolchain ( toolchain, binary) ?
826
+ . expect ( "binary not found" )
827
+ } else {
828
+ cfg. which_binary ( & utils:: current_dir ( ) ?, binary) ?
829
+ . expect ( "binary not found" )
830
+ } ;
814
831
815
832
utils:: assert_is_file ( & binary_path) ?;
816
833
0 commit comments