Giter Site home page Giter Site logo

lit's Introduction

lit

lit logo

"launch in time" - An easily configurable quicklauncher for your terminal. Think of it like Alfred, Launchbar or Raycast for your terminal. Use it as a replacement for Spotlight and make it trigger via your Cmd+Space.

Type away into the fuzzy prompt to

  • Launch apps
  • Find contacts
  • Translate
  • Calculate
  • Convert currencies

All the stuff you desired is directly integrated from you sheel via a simple YAML-config.

Demo

lit

Installation

macOS

brew tap toadle/lit
brew install lit-cli

or

Download a binary from the releases page.

or

Build it yourself (requires Go 1.18+):

go get
make install

User Manual

Everything lit does is based on regular terminal commands. lit will re-execute them on every change of your input and you can then navigate up and down to execute actions on the result.

You can launch it simply by typing lit in your terminal of choice.

Configuration

lit is configured through a file at ~/.lit.yml. If it does not exist you need to create it.

Here you can configure two kinds of sources for lit:

Calculators They are displayed above the input of your query. They should do a basic transformation of the input like calculations or translations. The result is then reduced to one line and displayed.

Searches They are displayed below the input of your query. They are supposed to return several lines of results which are then fuzzy-filtered by the query. It is possible to read the results through a regular expression in order to make it more usable.

A basic .lit.yml looks like this:

close_on_action: true/false

calculators:
  - command: "..."
    action: "..."
    label: "..."
  - ...

searches:
  - command: "..."
    format: "..."
    action: "..."
    labels:
      title: "..."
      description: "..."
  - ...

Here is what those values do:

General Settings close_on_action can be set to true or false. If true then lit will exist after you selected an entry. The default setting is false.

Calculators

calculators may contain several configurations which each will result in a new line getting added to lits interface above the query input.

command should contain a terminal command that gets re-excuted whenever the input changes. The input-value can be substituted with a {input}-placeholder. The result of the terminal command will be reduced to one line.

action should contain a terminal command that gets executed when you select the entry in the interface. The result of the command can be substituted via a {data}-placeholder. After selection lit will close.

label if you do not provide a label then lit will display the command next to it's result. Sometimes the commands can be very messy and verbose. Therefore if you provide a label lit will display it instead. The current input can be substituted via {input}.

Searches

searches may contain several configurations which are all executed when lit launches and will NOT be re-executed when the input changes (that will change in the future). All results will be combined and displayed under the query-input.

command should contain a terminal commands that gets executed ONCE when lit launches. Every line of the result will be one result in lit's interface.

format should contain a regular expression with capture groups that helps make sense of the command's result. The regexp will be applied to every line separately. The capture-groups will be available as {...}-substitutions in the action and labels.

action should contain a terminal command that gets executed when you select one of the results in the interface. The result of the command can be substituted via all {...}-placeholders that are available through the format-regexp's capture group. After selection lit will close.

labels here you can configure how the results from command get displayed. lit displays a title and description for each. For both substitutions via {...} are possible. Both entries can be left empty. lit will then default to looking for a {title} and {description} capture group in format in order to display something readable.

Example

This repository contains a .lit.example.yml that is contains a pretty great starting-point for you own configuration. This example-configuration contains the following features:

  • Translation using trans from translate-shell

  • Calculation using the phenomenal qalc from Qalculate!

  • Quick-launching apps using mdfind the command-line Spotlight-client on the mac

  • Searching contacts for your addressbook via mdfind.

All of the above is made for using it on a Mac. If somebody could provide a good Linux-starting-point I'd be happy to add it.

Good to know

Using pipes (|) in terminal commands

lit supports using | in all commands in order to chain several commands for more flexibility. It does so by implementing it's own output-redirection. Keep in mind that | normally is a feature of your shell of choice and not the commands themselves. Therefore don't get to many ideas using > or >> in your commands as lit currently does not support those.

Dealing with spaces

Spaces in commands normally delimit arguments. But sometimes spaces a also contained in paths or filenames. Therefore lit will treat spaces differently depending on where they appear: If a space appears in the configuration e.g. within a command or action-configuration they will be treated as argument-delimiters. When spaces appear in the results of a command or within the result of a {...}-substitution they will be kept as a single argument. If you need to extract results to several arguments of an action please consider using xargs.

License

MIT

Built using the great technologies provided by Charm

lit's People

Contributors

toadle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.