Active Members Fi8sVrs Posted April 18, 2013 Active Members Report Posted April 18, 2013 Bringing Bash's powerful command line editing to Microsoft Windows' cmd.exeIntroduction Clink enhances your productivity in Microsoft Windows' "cmd.exe".If you're familiar with Bash then you will be familiar with the changes that clink brings to "cmd.exe" (it uses the same 'Readline' library that Bash uses). It is a small utility to enhance "cmd.exe", adding more powerful command line completion, editing, and history. Features Powerful Bash-like line editing from GNU's Readline library. Read more on Readline's keyboard shortcuts. Superior path completion (TAB). Paste from clipboard (Ctrl-V). Support for the completion of executables/commands, and environment variables. Undo/Redo (Ctrl-_ or Ctrl-X, Ctrl-U) Improved command line history. Persists across sessions. Searchable (Ctrl-R and Ctrl-S). History expansion (e.g. !!, !<string>, and !$). [*] Scriptable completion using Lua. UsageThere are a variety of ways to start clink; If you installed the auto-run, start "cmd.exe" as per usual. To manually start, run the clink shortcut from the Start menu (or the clink.bat located in the install directory). To deploy clink to an existing cmd.exe process, use "<install_dir>\clink.exe inject" clink has been tested on Windows XP SP3 and upwards.Visual C++ Redistributable requirementclink requires that the Microsoft's Visual C++ 2010 Redistributable be install on your system. If you need to install them they can be found here; 32-bit (x86); Download Microsoft Visual C++ 2010 Redistributable Package (x86) from Official Microsoft Download Center 64-bit (x64); Download Microsoft Visual C++ 2010 Redistributable Package (x64) from Official Microsoft Download Center Writing completion scripts with LuaIt is easy to customise completion in clink with simple Lua scripts. It is a matter of writing a match generator function and registering the function with clink. When called the generator function adds matches to clink - if appropriate.A very basic example script gives the best overview of what is involved; -- Globals; -- rl_line_buffer : The current command line. -- rl_point : Current location of the cursor.function example_match_generator(text, first, last) -- Arguments; -- text : The word being completed, as tokenised by Readline. -- first : The index into rl_line_buffer where 'text' starts. -- last : Index into rl_line_buffer where 'text' ends. -- Returns; -- true : No further generator functions should be called. -- false : Generator has done nothing. Try the next generator. -- In this simple example generate a match when the user types -- the following; my_ma<TAB> if not rl_line_buffer == "my_ma" then return false end clink.add_match("my_match") return true end-- clink.register_match_generator(<function>, <priority>) clink.register_match_generator(example_match_generator, 50)Further examples can be found in clink's install directory.User's Lua scripts go in %ALLUSERSPROFILE%\clink\ (which is usually C:\ProgramData\clink\) and clink loads the .lua files it finds there. The keyboard shortcut Ctrl-Q will force clink to reload the Lua scripts - useful when writing your own scripts. Changing match display colour Create a new Lua script in %ALLUSERSPROFILE%\clink\ Add the following line (where X is a number in the range 0-15); clink.setpalette(X)For values for X run "color /?" on a command prompt. Building clink Download Premake from here; Premake | Industrious One There is a bug in Premake 4.3 that generates corrupt .vcxproj files. Please use 4.4 (or newer). [*] Run "premake <toolchain>" in the root of clink's source tree. Where "<toolchain>" is one of Premake's actions (see "premake --help") clink has been tested with vs2010, gmake (with mingw32), and vs2008. [*] Build scripts will be generated in ".build\<toolchain>\". For example; .build\vs2010\clink.sln. BuildsBuilds from the git repository can be found here;https://www.dropbox.com/sh/r9oqmn2mqfp3okp/Jm_F3pJSNIDownloadsSource: https://code.google.com/p/clink/ Quote