File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -360,6 +360,11 @@ pub fn cli() -> App<'static, 'static> {
360
360
. alias ( "docs" )
361
361
. about ( "Open the documentation for the current toolchain" )
362
362
. after_help ( DOC_HELP )
363
+ . arg (
364
+ Arg :: with_name ( "path" )
365
+ . long ( "path" )
366
+ . help ( "Only print the path to the documentation" ) ,
367
+ )
363
368
. arg (
364
369
Arg :: with_name ( "book" )
365
370
. long ( "book" )
@@ -929,7 +934,14 @@ fn doc(cfg: &Cfg, m: &ArgMatches) -> Result<()> {
929
934
"index.html"
930
935
} ;
931
936
932
- Ok ( cfg. open_docs_for_dir ( & utils:: current_dir ( ) ?, doc_url) ?)
937
+ let cwd = & utils:: current_dir ( ) ?;
938
+ if m. is_present ( "path" ) {
939
+ let doc_path = try!( cfg. doc_path_for_dir ( cwd, doc_url) ) ;
940
+ println ! ( "{}" , doc_path. display( ) ) ;
941
+ Ok ( ( ) )
942
+ } else {
943
+ Ok ( cfg. open_docs_for_dir ( cwd, doc_url) ?)
944
+ }
933
945
}
934
946
935
947
fn man ( cfg : & Cfg , m : & ArgMatches ) -> Result < ( ) > {
You can’t perform that action at this time.
0 commit comments