====== CliCommand Class ======
[[https://github.com/LibreCAD/LibreCAD_3/blob/master/lcUI/widgets/clicommand.h|Github Link]]
namespace lc::ui::widgets
----
===== Add Command =====
----
==== Description ====
Add and register a new command to the command line with the given lua callback. The command is enabled on adding. Returns false if command name already exists.
* Command - //string// , Lua Callback - //kaguya::LuaRef//
* //bool// (success)
==== Examples ====
* local clicommand = mainWindow:cliCommand()
clicommand:addCommand("SayHi", function() message("Hi!") end)
----
===== Write to Command Line =====
----
==== Description ====
Write a message to the command line. message("Text")
function actually calls this function to print a message to the clicommand.
* Message - //string//
==== Examples ====
* clicommand:write("Test Message")
----
===== Run Command =====
----
==== Description ====
Run the command i.e. run the lua callback corresponding to the given command. Dosen't do anything if command is not present or disabled.
* Command - //string//
==== Examples ====
* clicommand:runCommand("LINE")
----
===== Enable Command =====
----
==== Description ====
Enable the given command. Dosen't do anything if command dosen't exist.
* Command - //string//
==== Examples ====
* clicommand:enableCommand("LINE")
----
===== Disable Command =====
----
==== Description ====
Disables the given command. Dosen't do anything if command dosen't exist.
* Command - //string//
==== Examples ====
* clicommand:disableCommand("LINE")
----
===== Is Command Enabled =====
----
==== Description ====
Returns a boolean indicating whether the command is enabled or disabled.
* Command - //string//
* returns //bool//
==== Examples ====
* local enab = clicommand:isCommandEnabled("LINE")
----
===== Available Commands =====
----
==== Description ====
Returns a list of all available command names.
==== Examples ====
* local allcommands = clicommand:availableCommands()
for k,v in pairs(allcommands) do cliCommand:runCommand(v) end
----
===== Get Commands History =====
----
==== Description ====
Returns a list of all commands that have been entered since program started.
==== Examples ====
* local history = cliCommand:commandsHistory()
----
===== Clear CliCommand Output =====
----
==== Description ====
Clear the cli command console. Can also be accessed by using command "CLEAR" in the command line.
==== Examples ====
* cliCommand:clear()
----