Clink combines the native Windows shell cmd.exe
with the powerful command line editing features of the GNU Readline library, which provides rich completion, history, and line-editing capabilities. Readline is best known for its use in the well-known Unix shell Bash, the standard shell for Mac OS X and many Linux distributions.
Downloads are available from the releases page.
See the issues page for known issues or to file new issues.
- The same line editing as Bash (from the GNU Readline library version 8.0).
- History persistence between sessions.
- Context sensitive completion;
- Executables (and aliases).
- Directory commands.
- Environment variables
- Thirdparty tools; Git, Mercurial, SVN, Go, and P4.
- New keyboard shortcuts;
- Paste from clipboard (Ctrl+V).
- Incremental history search (Ctrl+R/Ctrl+S).
- Powerful completion (Tab).
- Undo (Ctrl+Z).
- Automatic
cd ..
(Ctrl+PgUp). - Environment variable expansion (Ctrl+Alt+E).
- Doskey alias expansion (Ctrl+Alt+F).
- (press Alt+H) for many more...)
- Scriptable completion with Lua.
- Colored and scriptable prompt.
- Auto-answering of the "Terminate batch job?" prompt.
There are a variety of ways to start Clink;
- If you installed the auto-run, just start
cmd.exe
. Runclink autorun --help
for more info. - To manually start, run the Clink shortcut from the Start menu (or the clink.bat located in the install directory).
- To establish Clink to an existing
cmd.exe
process, use<install_dir>\clink.exe inject
Clink can be extended through its Lua API which allows easy creation of context sensitive match generators, prompt filtering, and more. More details can be found in Clink's documentation here.
Clink uses Premake to generate Visual Studio solutions or makefiles for MinGW. Note that Premake >= 5.0-alpha12 is required.
- Cd to your clone of Clink.
- Run
premake5.exe <toolchain>
(where<toolchain>
is one of Premake's actions - seepremake5.exe --help
) - Build scripts will be generated in
.build\<toolchain>
. For example.build\vs2013\clink.sln
. - Call your toolchain of choice (VS, mingw32-make.exe, msbuild.exe, etc). GNU makefiles (Premake's gmake target) have a help target for more info.
- Run
npm install marked
to install the marked markdown library. - Run
premake5.exe docs
.
- Start Clink using any of the normal ways.
- Launch a debugger such as Visual Studio.
- Attach the debugger to the CMD.exe process that Clink was injected into.
- If you break into the debugger now, it will be inside Clink code, waiting for keyboard input.
- Here are a couple breakpoints that might be useful:
host::edit_line
is the start of showing a prompt and accepting input.line_editor_impl::update_internal
is where the match pipeline uses.generate()
to collect matches and.select()
to filter the matches.rl_module::on_input
andreadline_internal_char
(and the_rl_dispatch
inside it) is where keys are translated through Readline's keymap to invoke commands.rl_complete
orrl_menu_complete
orrl_old_menu_complete
are the Readline completion commands.alternative_matches
builds a Readline match array from the results collected by the match pipeline.
- Use
clink set lua.debug true
to enable using the Lua debugger. - Use
clink set lua.break_on_error true
to automatically break into the Lua debugger on any Lua script error. - Add a
pause()
line in a Lua script to break into the debugger at that spot, if thelua.debug
setting is enabled. - Use
help
in the Lua debugger to get help on using the Lua debugger.
Clink is distributed under the terms of the GNU General Public License v3.0.