Changes between Initial Version and Version 1 of CommandLineInterface


Ignore:
Timestamp:
Feb 13, 2012, 10:19:38 PM (13 years ago)
Author:
manualwiki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CommandLineInterface

    v1 v1  
     1= !RefactorErl CLI = 
     2 
     3This page introduces the Command Line Interface (CLI) of !RefactorErl. 
     4 
     5We provide the user with an [ErlangShellInterface Erlang shell interface], which proves to be pretty useful in most of the cases. However, we realised that sometimes one may need to access the tool from outside the Erlang shell. The proposed CLI provides a lightweight interface that can remotely execute Erlang commands in !RefactorErl. More precisely, it invokes Erlang functions that are specified by command line arguments. The method is based on [http://www.erlang.org/doc/man/escript.html Erlang Escript]. 
     6 
     7We note that the current version of CLI is a prototype, only discovering opportunities and usefulness of this kind of interface. Notice that the CLI is applicable directly by hand as well as indirectly by code editors. Latter makes !RefactorErl callable from editors that do not support Erlang. 
     8 
     9== Installation == 
     10 
     11If you have successfully downloaded and compiled !RefactorErl, you have nothing else to install. 
     12 
     13Before the first usage, you should redefine two functions defined in the !RefactorErl CLI: 
     14 
     15 * referlpath() defines the directory path to the tool (''.'' by default) 
     16 * referlnode() defines the node name of the tool (''refactorerl@localhost'' by default) 
     17 
     18Also, you should make the ''!RefactorErl'' EScript executable. You may use a command like 
     19 
     20{{{ 
     21chmod +x RefactorErl 
     22}}} 
     23 
     24== Usage == 
     25 
     26Using the CLI is pretty straightforward. You can simply pass the following data to the script as command line arguments: 
     27 
     28 * The name of the module the invoked function is located in 
     29 * The name of the invoked function 
     30 * The function arguments 
     31 
     32For example: 
     33{{{ 
     34/path/to/refactorerl/bin/RefactorErl mod fun arg1 arg2 "arg3" 
     35}}} 
     36 
     37will invoke ''mod:fun(arg1, arg2, arg3)'' inside !RefactorErl. 
     38 
     39Note that Erlang terms written with spaces should be enclosed by double quote marks. 
     40 
     41=== Handling the !RefactorErl server === 
     42 
     43First of all, if the !RefactorErl server is not running, you should start it up to be able to communicate with. Type 
     44{{{ 
     45RefactorErl start 
     46}}} 
     47 
     48to start up. This command starts an instance of the tool at the previously given node. If the server is already running, you get a message of it. 
     49 
     50Also, you can stop the previously started !RefactorErl instance. If the server was not running, you will be informed. 
     51 
     52{{{ 
     53RefactorErl stop 
     54}}} 
     55 
     56== Use cases == 
     57 
     58Resetting the database: 
     59{{{ 
     60RefactorErl reset 
     61RefactorErl ri reset 
     62}}} 
     63 
     64Adding files: 
     65{{{ 
     66RefactorErl ri add "/path/to/module.erl" 
     67}}} 
     68 
     69Listing database contents: 
     70{{{ 
     71RefactorErl ri ls 
     72}}} 
     73 
     74Running the query ''mods.funs'' 
     75{{{ 
     76RefactorErl ri q "mods.funs" 
     77}}} 
     78 
     79Renaming function ''mod:f/1'' to ''g'': 
     80{{{ 
     81RefactorErl ri renfun mod "{f, 1}" g 
     82}}}