All Projects → giann → Croissant

giann / Croissant

Licence: mit
🥐 A Lua REPL and debugger

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to Croissant

Lua Resty Repl
Interactive console (REPL) for Openresty and luajit code
Stars: ✭ 165 (-42.11%)
Mutual labels:  cli, debugger, repl
Brotab
Control your browser's tabs from the command line
Stars: ✭ 137 (-51.93%)
Mutual labels:  commandline, cli
Appicon
AppIcon generates *.appiconset contains each resolution image for iOS
Stars: ✭ 1,454 (+410.18%)
Mutual labels:  commandline, cli
You Dont Need Gui
Stop relying on GUI; CLI **ROCKS**
Stars: ✭ 4,766 (+1572.28%)
Mutual labels:  commandline, cli
Fileinfo
📄Get information on over 10,000 file extensions right from the terminal
Stars: ✭ 86 (-69.82%)
Mutual labels:  commandline, cli
Lc
licensechecker (lc) a command line application which scans directories and identifies what software license things are under producing reports as either SPDX, CSV, JSON, XLSX or CLI Tabular output. Dual-licensed under MIT or the UNLICENSE.
Stars: ✭ 93 (-67.37%)
Mutual labels:  commandline, cli
Licenseplist
A license list generator of all your dependencies for iOS applications
Stars: ✭ 1,996 (+600.35%)
Mutual labels:  commandline, cli
Gitviper
Enhanced git experience using the command line
Stars: ✭ 35 (-87.72%)
Mutual labels:  commandline, cli
Ace
Node.js framework for creating command line applications
Stars: ✭ 233 (-18.25%)
Mutual labels:  commandline, cli
slyblime
Interactive Lisp IDE with REPL, Inspector, Debugger and more for Sublime Text 4.
Stars: ✭ 35 (-87.72%)
Mutual labels:  debugger, repl
Cliffy
NodeJS Framework for Interactive CLIs
Stars: ✭ 263 (-7.72%)
Mutual labels:  cli, repl
Swiftline
Swiftline is a set of tools to help you create command line applications.
Stars: ✭ 1,156 (+305.61%)
Mutual labels:  commandline, cli
Slackcat
CLI utility to post files and command output to slack
Stars: ✭ 1,127 (+295.44%)
Mutual labels:  commandline, cli
Cordless
The Discord terminal client you never knew you wanted.
Stars: ✭ 1,391 (+388.07%)
Mutual labels:  commandline, cli
Ntutils
Various Command Line Utilities Ported to Windows NT
Stars: ✭ 58 (-79.65%)
Mutual labels:  commandline, cli
Gitin
commit/branch/workdir explorer for git
Stars: ✭ 1,815 (+536.84%)
Mutual labels:  commandline, cli
Frick
frick - aka the first debugger built on top of frida
Stars: ✭ 267 (-6.32%)
Mutual labels:  cli, debugger
Fontpreview
Highly customizable and minimal font previewer written in bash
Stars: ✭ 661 (+131.93%)
Mutual labels:  commandline, cli
Clipp
easy to use, powerful & expressive command line argument parsing for modern C++ / single header / usage & doc generation
Stars: ✭ 687 (+141.05%)
Mutual labels:  commandline, cli
Gitlab Cli
Create a merge request from command line in gitlab
Stars: ✭ 224 (-21.4%)
Mutual labels:  commandline, cli

croissant

Croissant

🥐 A Lua REPL and debugger implemented in Lua

croissant

Note: Croissant is in active development.

Croissant is based on sirocco.

Features

  • Syntax highlighting
  • Code parsed as you type
  • Persistent history
  • Multiline
  • Formatted returned values
  • Basic auto-completion
  • Contextual help (C-h or M-h on an identifier)
  • Debugger

Planned

  • Customization: keybinding, theme, etc.

Installation

Requirements:

  • Lua 5.1/JIT/5.2/5.3 (needs more testing for < 5.3 though)
  • luarocks >= 3.0 (Note: hererocks -rlatest will install 2.4, you need to specify it with -r3.0)
luarocks install croissant

Usage

# Make sure lua/luarocks binaries are in your $PATH (~/.luarocks/bin)
croissant [-h] [<input>] [<arguments>] [-d [<debugger>] ...]
  • <input>: a lua file to run or debug. If not provided, croissant will run the REPL.
  • <arguments>: arguments to pass to the <input> script
  • --debugger -d --break -b [file.lua:line] ...: runs croissant in debugger mode and optionally sets breakpoints
  • --help -h: shows help message

Debugger

croissant

Using the cli

croissant filetodebug.lua -d

This will start croissant in debugger mode. You can then add some breakpoints with the breakpoint command and start your script with the run command.

In your code

Alternatively, you can require the debugger in your script where you want to break:

require "croissant.debugger"()

Commands

Croissant looks at the first word of your entry and runs any command it matches. It'll otherwise runs the entry as Lua code in the current frame context. If empty, croissant executes the previous repeatable command.

  • help [<command>]: prints general help or help about specified command
  • run: starts your script
  • args <argument> ...: set arguments to pass to your script
  • watch <expression>: breaks when evaluated Lua expression changes value
  • breakpoint <where> [<when>]: add a new breakpoint at <where> (can be line number in current file, file.lua:line or a function name) if <when> (lua code evaluated in the breakpoint context) is true or absent
  • condition <#id> <when>: change breaking condition of breakpoint #id
  • delete <#id>: delete breakpoint or watchpoint #id
  • enable <#id>: enable breakpoint or watchpoint #id
  • disable <#id>: disable breakpoint or watchpoint #id
  • display <expression>: display evalued Lua expression each time the program stops
  • undisplay <#id>: dlete display #id
  • clear: deletes all breakpoints, watchpoints and displays
  • info <what>:
    • breakpoints: list breakpoints and watchpoints
    • locals: list locals of the current frame
    • displays: list displays
  • step (repeatable): step in the code
  • next (repeatable): step in the code going over any function call
  • finish (repeatable): will break after leaving the current function
  • up (repeatable): go up one frame
  • down (repeatable): go down one frame
  • continue (repeatable): continue until hitting a breakpoint. If no breakpoint are specified, clears debug hooks
  • eval <code>: runs code (useful to disambiguate from debugger commands)
  • depth <depthLimit> <itemsLimit>: set depth limit and number of items when pretty printing values
  • exit: quit
  • where [<rows>]: prints <rows> or conf.whereRows rows around the current line. Is ran for you each time you step in the code or change frame context

where command

  • trace: prints current stack trace and highlights current frame.

where trace

Caveats

  • Pretty printing values can be expensive in CPU and memory: avoid dumping either large of deeply nested tables. You can play with the dump.depthLimit and dump.itemsLimit value in your ~/.croissantrc or the depth command to avoid exploring to far down in complex tables.
  • The debugger will slow your program down. Croissant will try and clear hooks whenever possible but if you know you won't hit anymore breakpoints, do a clear before doing continue.
  • A breakpoint on a function name will not work if the function is not called by its name in your code. Example:
local function stopMe()
    -- ...
end

local function call(fn)
    fn()
end

call(stopMe)

Configuration

You can customize some aspect of croissant by writing a ~/.croissantrc lua file. Here are the default values than you can overwrite:

return {
    -- Default prompt
    prompt = "→ ",
    -- Prompt used when editing multiple lines of code
    continuationPrompt = ".... ",

    -- Maximum amount of remembered lines
    -- Croissant manages two history file: one for the repl (~/.croissant_history),
    -- one for the debugger (~/.croissant_debugger_history)
    historyLimit = 1000,

    -- How many rows `where` should print around the current line
    whereRows = 4,

    -- Syntax highlighting colors
    -- Available colors are: black, red, green, yellow, blue, magenta, cyan, white.
    -- They can also be combined with modifiers: bright, dim, underscore, blink, reverse, hidden
    syntaxColors = {
        constant   = { "bright", "yellow" },
        string     = { "green" },
        comment    = { "dim", "cyan" },
        number     = { "yellow" },
        operator   = { "yellow" },
        keywords   = { "bright", "magenta" },
        identifier = { "blue" },
    },

    dump = {
        -- Nesting limit at which croissant will stop when pretty printing a table
        depthLimit = 5,
        -- If a table has more items than itemsLimit, will stop there and print ellipsis
        itemsLimit = 30
    }
}

Löve 2D

Read and understand the Caveats section.

luarocks install croissant --tree mygame/lua_modules

Tell Löve to search in lua_modules:

love.filesystem.setRequirePath(
    love.filesystem.getRequirePath()
        .. ";lua_modules/share/lua/5.1/?/init.lua"
        .. ";lua_modules/share/lua/5.1/?.lua"
)

love.filesystem.setCRequirePath(
    love.filesystem.getCRequirePath()
    .. ";lua_modules/lib/lua/5.1/?.so"
)

Require croissant.debugger where you want to break:

require "croissant.debugger"()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].