User Tools

Site Tools


Sidebar

Introduction

* Home

Documentation & help

LibreCAD Community

Help on DokuWiki

Temporary shorcuts

dev:v3:gui_api:clicommand:clicommand

CliCommand Class

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() 

dev/v3/gui_api/clicommand/clicommand.txt · Last modified: 2020/07/08 06:06 by jedi18