@@ -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" )
@@ -451,7 +457,13 @@ pub fn cli() -> App<'static, 'static> {
451
457
. subcommand (
452
458
SubCommand :: with_name ( "which" )
453
459
. about ( "Display which binary will be run for a given command" )
454
- . arg ( Arg :: with_name ( "command" ) . required ( true ) ) ,
460
+ . arg ( Arg :: with_name ( "command" ) . required ( true ) )
461
+ . arg (
462
+ Arg :: with_name ( "toolchain" )
463
+ . help ( TOOLCHAIN_ARG_HELP )
464
+ . long ( "toolchain" )
465
+ . takes_value ( true ) ,
466
+ ) ,
455
467
)
456
468
. subcommand (
457
469
SubCommand :: with_name ( "doc" )
@@ -783,10 +795,15 @@ fn run(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
783
795
784
796
fn which ( cfg : & Cfg , m : & ArgMatches < ' _ > ) -> Result < ( ) > {
785
797
let binary = m. value_of ( "command" ) . expect ( "" ) ;
786
-
787
- let binary_path = cfg
788
- . which_binary ( & utils:: current_dir ( ) ?, binary) ?
789
- . expect ( "binary not found" ) ;
798
+ let toolchain_provided = m. is_present ( "toolchain" ) ;
799
+ let binary_path = if toolchain_provided {
800
+ let toolchain = m. value_of ( "toolchain" ) . expect ( "" ) ;
801
+ cfg. which_binary_by_explicit_toolchain_path ( toolchain, binary) ?
802
+ . expect ( "binary not found" )
803
+ } else {
804
+ cfg. which_binary ( & utils:: current_dir ( ) ?, binary) ?
805
+ . expect ( "binary not found" )
806
+ } ;
790
807
791
808
utils:: assert_is_file ( & binary_path) ?;
792
809
0 commit comments