Changes

Jump to: navigation, search

CLI

9,860 bytes added, 14:56, 17 May 2018
Created page with "'''Home * User Interface * Command Line Interface''' '''Command Line Interface (CLI)''',<br/> a means of a [https://en.wikipedia.org/wiki/User_%28computing%..."
'''[[Main Page|Home]] * [[User Interface]] * Command Line Interface'''

'''Command Line Interface (CLI)''',<br/>
a means of a [https://en.wikipedia.org/wiki/User_%28computing%29 user], [https://en.wikipedia.org/wiki/User_agent agent] or [https://en.wikipedia.org/wiki/Client_%28computing%29 client], [https://en.wikipedia.org/wiki/Interaction interacting] with a [[Program|computer program]] in form of [https://en.wikipedia.org/wiki/Plain_text plain text-] or command lines. Programs are either the [https://en.wikipedia.org/wiki/Operating_system operating system], their [https://en.wikipedia.org/wiki/Operating_system_shell#Command-line_OS_shells command-line shells], or [https://en.wikipedia.org/wiki/Application_software application software], for instance chess programs.

=History=
The CLI has its origins in [https://en.wikipedia.org/wiki/Teleprinter teletype] and later [https://en.wikipedia.org/wiki/Computer_terminal computer terminals] to act as a [https://en.wikipedia.org/wiki/System_console system console] and sequential [https://en.wikipedia.org/wiki/Input_device input-] and [https://en.wikipedia.org/wiki/Output_device output device], where the program [http://en.wiktionary.org/wiki/prompt prompts] for input, that is, prints a message or symbol on the teletype printer to indicate readiness for user input, and acts upon command lines as they are entered.

=Unix Philosophy=
[[Unix]] and its [https://en.wikipedia.org/wiki/Composability composable design] and [https://en.wikipedia.org/wiki/Unix_philosophy philosophy] originated by [[Ken Thompson]] was summarized by [https://en.wikipedia.org/wiki/Douglas_McIlroy Doug McIlroy], contributor to [https://en.wikipedia.org/wiki/Pipeline_%28Unix%29 Unix pipes] <ref>[https://en.wikipedia.org/wiki/Unix_philosophy#McIlroy:_A_Quarter_Century_of_Unix Unix philosophy - McIlroy: A Quarter Century of Unix - Wikipedia]</ref>: ''Write programs that do one thing and do it well. Write programs to work together. Write programs to handle [https://en.wikipedia.org/wiki/Standard_streams text streams], because that is a universal interface''.

=Shell and Applications=
[https://en.wikipedia.org/wiki/Operating_system Operating systems] such as [[MS-DOS]], [[Unix]] or [[Linux]] per default provide a [https://en.wikipedia.org/wiki/Shell_%28computing%29 shell] as CLI, such as [https://en.wikipedia.org/wiki/COMMAND.COM Command.com] or [https://en.wikipedia.org/wiki/Unix_shell Unix shell]. Modern desktop versions of [[Windows]] use the [https://en.wikipedia.org/wiki/Windows_shell Windows shell] which is a [https://en.wikipedia.org/wiki/Graphical_user_interface graphical user interface], but include a [https://en.wikipedia.org/wiki/Command_Prompt command prompt window] for [https://en.wikipedia.org/wiki/Console_application console applications]. Most operating systems support [https://en.wikipedia.org/wiki/Inter-process_communication inter-process communication] with [https://en.wikipedia.org/wiki/Standard_streams standard streams] or [https://en.wikipedia.org/wiki/Named_pipe named pipes] and are able to [https://en.wikipedia.org/wiki/Redirection_%28computing%29 redirect] standard streams from and to other [[Process|processes]]. Command line interfaces are therefor often preferred by advanced users or software developers, as they provide a more concise and powerful way to control a program or operating system, and are generally easier to automate via [https://en.wikipedia.org/wiki/Scripting_language scripting] <ref>[https://en.wikipedia.org/wiki/Command-line_interface Command-line interface from Wikipedia]</ref>.

=Commands=
Text commands as entered via the [https://en.wikipedia.org/wiki/Computer_keyboard keyboard], are a sequence of [https://en.wikipedia.org/wiki/ASCII ASCII]- or [https://en.wikipedia.org/wiki/Unicode Unicode] characters finally confirmed and send to the programs standard input by typing the [https://en.wikipedia.org/wiki/Enter_key Enter key], which is typically encoded at the end of the command string as [https://en.wikipedia.org/wiki/Newline newline] character ("\n") (Posix) or a sequence of [https://en.wikipedia.org/wiki/Carriage_return carriage return] ("\r") and newline under [[Windows]] <ref>[https://en.wikipedia.org/wiki/Unix2dos unix2dos from Wikipedia]</ref>. [https://en.wikipedia.org/wiki/Syntax Syntax] and [https://en.wikipedia.org/wiki/Semantics semantics] of commands and their required or optional [https://en.wikipedia.org/wiki/Command-line_argument#Arguments arguments] depend on the OS or application of course, its state or [https://en.wikipedia.org/wiki/Game_mechanics#Game_modes mode]. When the command is [https://en.wikipedia.org/wiki/Parsing parsed], [https://en.wikipedia.org/wiki/Interpreter_%28computing%29 interpreted] and [https://en.wikipedia.org/wiki/Execution_%28computing%29 executed], [https://en.wikipedia.org/wiki/Acknowledgement_%28data_networks%29 acknowledgments], results or answers are send back for a communication according to a [https://en.wikipedia.org/wiki/Communications_protocol protocol].

=CLI and Chess Engines=
Most current chess engines are implemented as [https://en.wikipedia.org/wiki/Console_application console application] to communicate via a command line interface. This is the most [https://en.wikipedia.org/wiki/Software_portability#Source_code_portability portable] way, supported by all common operating systems, [[Languages|programming languages]] and their [https://en.wikipedia.org/wiki/Standard_library standard libraries]. A proprietary chess engine interface for direct console play may be implemented by printing an [[Graphics Programming#ASCIIDiagrams|ASCII-board]] and the [[Game Notation|game record]], and prompting for a move or command, also streaming the [[Iterative Deepening |iterative]] "thinking process", i.e. formatted text lines with [[Score|score]], [[Depth|depth]], and [[Principal Variation|principal variation]] to the console.

==Interruptible==
[[Pondering]] and the need to [[Entering Moves|enter moves]] and commands even if the program is "thinking", requires an interruptible [[Search|search]] routine. In single tasking operating systems like [[MS-DOS]], engines often used [https://en.wikipedia.org/wiki/Coroutine coroutines] to implement internal [https://en.wikipedia.org/wiki/Context_switch context switching] between search and user interaction. Today, it is more common to rely on [https://en.wikipedia.org/wiki/Multi-threading multithreading] abilities of modern operating systems, and to use an explicit [[Thread|I/O-thread]], while the search routine is regularly pondering whether it needs to be interrupted by pending input received by another thread, with the option to asynchronously stop the search.

==Protocols==
The UNIX paradigm was further archetype of both primary [[Protocols|protocols]] in computer chess, to communicate with a [[GUI]] or game playing controller or server - the [[Chess Engine Communication Protocol]], and [[UCI]]. In conformance with these chess communication protocols, engines [https://en.wikipedia.org/wiki/Standard_streams standard streams] are redirected and controlled by a parent process such as the [[GUI|chess GUI]], a game- or match controller like [[Cutechess-cli]] for automatic [[Engine Testing#Matches|engine-engine matches]] <ref>[http://www.talkchess.com/forum/viewtopic.php?t=27024 Cutechess-cli: A command line tool for engine-engine matches] by [[Ilari Pihlajisto]], [[CCC]], March 16, 2009</ref>, or their [https://en.wikipedia.org/wiki/Proxy_server proxies] inside a [https://en.wikipedia.org/wiki/Computer_network computer network].

=See also=
* [[Graphics Programming#ASCIIDiagrams|ASCII Diagrams]]
* [[CHEKMO-II#PDP8|CHEKMO-II]] on a [[PDP-8]] (Video)
* [[Chess Game]]
* [[CPW-Engine_com]]
* [[Cutechess-cli]]
* [[Entering Moves]]
* [[GUI|Graphical User Interface]]
* [[InBetween]]
* [[Protocols]]

=Forum Posts=
* [https://www.stmintz.com/ccc/index.php?id=389667 Kiwi for Win98 and input-reading stuff] by [[Alessandro Scotti]], [[CCC]], September 29, 2004 » [[Kiwi]], [[Windows]], [[Cpp|C++]], [[Thread]]
* [http://www.open-aurec.com/wbforum/viewtopic.php?f=4&t=1622 Safe I/O (repeated)] by [[Fabien Letouzey]], [[Computer Chess Forums|Winboard Forum]], February 11, 2005
* [http://www.talkchess.com/forum/viewtopic.php?t=27024 Cutechess-cli: A command line tool for engine-engine matches] by [[Ilari Pihlajisto]], [[CCC]], March 16, 2009
* [http://www.talkchess.com/forum/viewtopic.php?t=34051 Ponder console input move problem] by [[Vlad Stamate]], [[CCC]], April 28, 2010 » [[Pondering]]
* [http://www.talkchess.com/forum/viewtopic.php?t=50630 Bash script to start UCI engine and get evaluation] by Scott O'Nan, [[CCC]], December 25, 2013
* [http://www.talkchess.com/forum/viewtopic.php?t=56363 how to probe egtb from console?] by [[Marco Belli]], [[CCC]], May 15, 2015 » [[Endgame Tablebases]]
* [http://www.talkchess.com/forum/viewtopic.php?t=61988 command line engine match?] by [[Erin Dame]], [[CCC]], November 06, 2016

=External Links=
* [https://en.wikipedia.org/wiki/Command-line_interface Command-line interface from Wikipedia]
* [https://en.wikipedia.org/wiki/List_of_command-line_interpreters List of command-line interpreters from Wikipedia]
* [https://en.wikipedia.org/wiki/Redirection_%28computing%29 Redirection from Wikipedia]
* [https://en.wikipedia.org/wiki/Shell_%28computing%29 Shell (computing) from Wikipedia]
* [https://en.wikipedia.org/wiki/Command_Prompt Command Prompt from Wikipedia]
: [https://en.wikipedia.org/wiki/COMMAND.COM COMMAND.COM]
* [https://en.wikipedia.org/wiki/Unix_shell Unix shell from Wikipedia]
: [https://en.wikipedia.org/wiki/Thompson_shell Thompson shell] by [[Ken Thompson]]
* [https://en.wikipedia.org/wiki/System_console System console from Wikipedia]

=References=
<references />

'''[[User Interface|Up one Level]]'''

Navigation menu