All Projects → refIekt → lit

refIekt / lit

Licence: MPL-2.0 License
Shine a light on terminal commands. 🔥

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to lit

greenwood
Greenwood is your workbench for the web, focused on supporting modern web standards and development to help you create your next project.
Stars: ✭ 48 (+300%)
Mutual labels:  lit
stoxy
Stoxy is a state management API for all modern Web Technologies
Stars: ✭ 73 (+508.33%)
Mutual labels:  lit
Fable.Lit
Write Fable Elmish apps with Lit
Stars: ✭ 64 (+433.33%)
Mutual labels:  lit
pharos
JSTOR's design system
Stars: ✭ 48 (+300%)
Mutual labels:  lit
pry-inline
Inline variables view like RubyMine in Pry
Stars: ✭ 55 (+358.33%)
Mutual labels:  pry
lit
Lit is a simple library for building fast, lightweight web components.
Stars: ✭ 12,406 (+103283.33%)
Mutual labels:  lit
lit-ncov-report
洛阳理工学院 "健康状况管控平台" , 非官方Python封装库兼CLI工具与拓展实现
Stars: ✭ 41 (+241.67%)
Mutual labels:  lit
eslint-plugin-lit
lit-html support for ESLint
Stars: ✭ 90 (+650%)
Mutual labels:  lit
rollup-plugin-lit-css
Moved to https://github.com/bennypowers/lit-css
Stars: ✭ 35 (+191.67%)
Mutual labels:  lit
pry-test
A small test framework that supports debugging test failures & errors when they happen
Stars: ✭ 24 (+100%)
Mutual labels:  pry
pwa-lit-template
A template for building Progressive Web Applications using Lit and Vaadin Router.
Stars: ✭ 159 (+1225%)
Mutual labels:  lit
Pry Byebug
Step-by-step debugging and stack navigation in Pry
Stars: ✭ 1,827 (+15125%)
Mutual labels:  pry
Pry
A runtime developer console and IRB alternative with powerful introspection capabilities.
Stars: ✭ 6,351 (+52825%)
Mutual labels:  pry
Unityurptoonlitshaderexample
A very simple toon lit shader example, for you to learn writing custom lit shader in Unity URP
Stars: ✭ 2,988 (+24800%)
Mutual labels:  lit
Lit
World's smallest responsive 🔥 css framework (395 bytes)
Stars: ✭ 1,866 (+15450%)
Mutual labels:  lit
outline
Outline is a web component based design system starter kit. Outline is based on the latest technologies and tools to help your component authoring experience and facilitate adoption in your organization.
Stars: ✭ 28 (+133.33%)
Mutual labels:  lit
bui
‹b› Web components for creating applications – built by Blackstone Publishing using lit-html and lit-element
Stars: ✭ 29 (+141.67%)
Mutual labels:  lit
printer
A fancy logger yet lightweight, and configurable. 🖨
Stars: ✭ 65 (+441.67%)
Mutual labels:  filter-logs

Lit CLI

Gem Version GitHub code size in bytes

Shine a light on terminal commands. 🔥

Lit lets you create console logs that are only visible after prefixing a command with lit. You can use flags to filter the types of logs and step through your application at runtime, essentially turning your logs into breakpoints. You can press Enter to continue to the next step or press P to begin a Pry session. Lit was originally created to view the reflections generated by Reflekt via the command line, but can be used in a range of applications.

Usage

Simply start any command with lit. For example a script like ruby script.rb becomes:

lit ruby script.rb

Then run the application and watch the terminal window for Lit messages:

Flags

Lit accepts flags to modify behaviour. They are prefixed with an @ and appended after the lit command:

lit @<flag-name> ruby <script-name>.rb

Flags start with an @ instead of a -- so that they aren't confused with flags for the original command that Lit is firing off.

@step

Step through the code. The terminal will stop at each lit() message, then prompt you to press Enter to continue to the next message or press P to enter a Pry session.

lit @step ruby script.rb

When in a Pry session, enter x to exit Pry or !!! to exit the program (use x; to access a variable called x).

Note: Only files required via require_relative are currently supported for Pry session.
Note: Pry is not available to lit() messages in the first file to require 'lit_cli', so require Lit in your application's entry point / main file if you need this feature.

@status

Filter logs by message status:

lit @status=error ruby script.rb

Multiple statuses are comma separated:

lit @status=fail,error ruby script.rb

@type

Filter logs by message type:

lit @type=cat,dog ruby script.rb

Types are optional and represent the type of data, similar to a class.

@delay

Delay the execution of a message to make fast outputting logs easier to read. The default delay is 0 seconds (no delay) but can be any positive Integer or Float, for example:

lit @delay=1 ruby script.rb

Installation

In Gemfile add:

gem 'lit-cli'

In terminal run:

bundle install

Or:

gem install lit-cli

If an application is currently using Lit then the lit command will already be available in your terminal without any installation required.

API

Instructions for integrating your application with Lit.

Usage

Require lit_cli at the top of your file:

require 'lit_cli'

Include LitCLI in your module or class:

class ExampleClass
  include LitCLI

Then use the lit() instance method:

lit "message"

lit()

lit(message, status = :info, type = nil, context = nil)
  • String message - The message to show.
  • Symbol status (optional) - The status of the message such as :info, :warn or :error.
  • Symbol type (optional) - The type of data this message represents such as :cat or :dog.
  • String context (optional) - The current class name or instance ID, anything that gives context.

Available statuses and types can be configured, see lib/config.rb and demo/demo.rb for more info.

Symbols

Special characters convey extra meaning when embedded in the message string.

method()

lit "message method()"

Placing () next to a word will style them as a method.

#number

lit "message #1"

Placing a # next to a number will style them as a number.

>indent

lit "> message"

Placing a > at the start of a message will indent the log in the console. Multiple >>> symbols can be used and for each one, two spaces of indentation will be added. Indentation is not preserved when using @status or @type filters.

^separator

lit "^ message"

Placing a ^ at the start of a message will add a line break above the log in the console. Multiple ^^^ symbols can be used and for each one, one line break will be added. Line breaks are not preserved when using @status or @type filters.

Code as comments

You can use the lit() method in place of comments to help document your code. This:

# Create control for method.
control = Control.new(action, 0, @@reflekt.aggregator)
action.control = control

Becomes this:

lit "Create control for #{method} method"
control = Control.new(action, 0, @@reflekt.aggregator)
action.control = control

Now you've commented your code and your comments double as logs.

Emoji support

You can even use the emoji 🔥() instead of lit() to call the method... cause why not? Climate change is real and we're all going to die anyway. So the final code could be:

🔥 "Create control for #{method} method"
control = Control.new(action, 0, @@reflekt.aggregator)
action.control = control

The lit emoji acts as a nice sectional heading too. These are all just ideas and it's up to you to decide how to write code and save the future of humanity.

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].