@@ -1781,12 +1781,23 @@ function defineDefaultCommands(repl) {
1781
1781
const line = `.${ name } ${ cmd . help ? spaces + cmd . help : '' } \n` ;
1782
1782
this . output . write ( line ) ;
1783
1783
} ) ;
1784
+ this . output . write ( '\n in the Node.js REPL you may write regular JavaScript code\nand use REPL commands, the REPL commands are listed above\n' )
1784
1785
this . output . write ( '\nPress Ctrl+C to abort current expression, ' +
1785
1786
'Ctrl+D to exit the REPL\n' ) ;
1786
1787
this . displayPrompt ( ) ;
1787
1788
} ,
1788
1789
} ) ;
1789
-
1790
+ repl . defineCommand ( 'helpC' , {
1791
+ help : 'get help for a specific command' ,
1792
+ action : function ( cmd ) {
1793
+ if ( this . commands [ cmd ] ) {
1794
+ this . output . write ( cmd . help ) ;
1795
+ } else {
1796
+ this . output . write ( 'Command not found' ) ;
1797
+ }
1798
+ this . displayPrompt ( ) ;
1799
+ }
1800
+ } )
1790
1801
repl . defineCommand ( 'save' , {
1791
1802
help : 'Save all evaluated commands in this REPL session to a file' ,
1792
1803
action : function ( file ) {
@@ -1801,7 +1812,7 @@ function defineDefaultCommands(repl) {
1801
1812
} ) ;
1802
1813
1803
1814
repl . defineCommand ( 'load' , {
1804
- help : 'Load JS from a file into the REPL session' ,
1815
+ help : 'Load JS (variables, functions, etc) from a file into the REPL session' ,
1805
1816
action : function ( file ) {
1806
1817
try {
1807
1818
const stats = fs . statSync ( file ) ;
@@ -1826,7 +1837,7 @@ function defineDefaultCommands(repl) {
1826
1837
} ) ;
1827
1838
if ( repl . terminal ) {
1828
1839
repl . defineCommand ( 'editor' , {
1829
- help : 'Enter editor mode' ,
1840
+ help : 'Enter editor mode (JS) ' ,
1830
1841
action ( ) {
1831
1842
_turnOnEditorMode ( this ) ;
1832
1843
this . output . write (
0 commit comments