File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1386,6 +1386,15 @@ mod cmd {
13861386 }
13871387 }
13881388
1389+ fn show_current_directory ( editor : & mut Editor , args : & [ & str ] , _: PromptEvent ) {
1390+ match std:: env:: current_dir ( ) {
1391+ Ok ( cwd) => editor. set_status ( format ! ( "Current working directory is {}" , cwd. display( ) ) ) ,
1392+ Err ( e) => {
1393+ editor. set_error ( format ! ( "Couldn't get the current working directory: {}" , e) )
1394+ }
1395+ }
1396+ }
1397+
13891398 pub const TYPABLE_COMMAND_LIST : & [ TypableCommand ] = & [
13901399 TypableCommand {
13911400 name : "quit" ,
@@ -1562,6 +1571,13 @@ mod cmd {
15621571 fun : change_current_directory,
15631572 completer : Some ( completers:: directory) ,
15641573 } ,
1574+ TypableCommand {
1575+ name : "show-directory" ,
1576+ alias : Some ( "pwd" ) ,
1577+ doc : "Show the current working directory." ,
1578+ fun : show_current_directory,
1579+ completer : None ,
1580+ } ,
15651581 ] ;
15661582
15671583 pub static COMMANDS : Lazy < HashMap < & ' static str , & ' static TypableCommand > > = Lazy :: new ( || {
You can’t perform that action at this time.
0 commit comments