All Projects → giann → sirocco

giann / sirocco

Licence: MIT license
🦜 A collection of interactive command line prompts for Lua

Programming Languages

lua
6591 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to sirocco

impromptu.nvim
Create prompts fast and easy
Stars: ✭ 39 (-54.12%)
Mutual labels:  prompt
guri
A simple and fast Oh-My-Zsh theme
Stars: ✭ 19 (-77.65%)
Mutual labels:  prompt
CLI-Autocomplete
Cross-platform flexible autocomplete library for your CLI applications.
Stars: ✭ 21 (-75.29%)
Mutual labels:  prompt
ax5ui-dialog
Javascript UI Component - Dialog - JavaScript Dialog / Bootstrap Dialog
Stars: ✭ 29 (-65.88%)
Mutual labels:  prompt
justified
Wrap, align and justify the words in a string.
Stars: ✭ 30 (-64.71%)
Mutual labels:  prompt
whaaaaat
Inquirer.js port to Python (https://www.npmjs.com/package/inquirer). people blame me for staling this project. I do not have time to work on this right now - whaaaaat do you want me to do? take it offline?
Stars: ✭ 73 (-14.12%)
Mutual labels:  prompt
react-st-modal
Simple and flexible modal dialog component for React JS
Stars: ✭ 41 (-51.76%)
Mutual labels:  prompt
cmder-powershell-powerline-prompt
Custom PowerShell prompt for Cmder on Windows
Stars: ✭ 94 (+10.59%)
Mutual labels:  prompt
requestty
An easy-to-use collection of interactive cli prompts inspired by Inquirer.js.
Stars: ✭ 158 (+85.88%)
Mutual labels:  prompt
Inquirer.cs
A collection of common interactive command line user interfaces. Port of Inquirer.js
Stars: ✭ 26 (-69.41%)
Mutual labels:  prompt
bureau
💻 Informative and fast ZSH prompt with git status. Works well with HUGE repositories. Show username, hostname, path, git branch and status.
Stars: ✭ 27 (-68.24%)
Mutual labels:  prompt
cli-autocomplete
A command line prompt with autocompletion.
Stars: ✭ 27 (-68.24%)
Mutual labels:  prompt
slick
async ZSH prompt
Stars: ✭ 21 (-75.29%)
Mutual labels:  prompt
credit-card-prompt
Credit card prompt with validation and address lookup
Stars: ✭ 13 (-84.71%)
Mutual labels:  prompt
use-climate-change-reminder
🌳 Fight the climate change crisis by spreading the message for how you can help
Stars: ✭ 45 (-47.06%)
Mutual labels:  prompt
terminer
Upgrade your terminal experience with a single command.
Stars: ✭ 28 (-67.06%)
Mutual labels:  prompt
inquire
A Rust library for building interactive prompts
Stars: ✭ 419 (+392.94%)
Mutual labels:  prompt
fishline
A powerline prompt framework for the fish-shell built in fish-shell.
Stars: ✭ 66 (-22.35%)
Mutual labels:  prompt
PromptPapers
Must-read papers on prompt-based tuning for pre-trained language models.
Stars: ✭ 2,317 (+2625.88%)
Mutual labels:  prompt
tardy
Deal with CLI prompts in style
Stars: ✭ 40 (-52.94%)
Mutual labels:  prompt

sirocco

Sirocco

A collection of interactive command line prompts for Lua

sirocco

Note: Sirocco is in active development.

Installing

Requirements:

  • Lua 5.1/JIT/5.2/5.3
  • luarocks >= 3.0 (Note: hererocks -rlatest will install 2.4, you need to specify it with -r3.0)
luarocks install sirocco

Quickstart

See example.lua for an exhaustive snippet of all sirocco's features.

Text prompt

Prompt

Basic text prompt. Every prompt inherits from it so most of its options apply to them.

Prompt {
    -- The prompt
    prompt         = "A simple question\n",
    -- A placeholder that will dissappear once the user types something
    placeholder    = "A simple answer",
    -- Whether the answer is required or not
    required       = true,
    -- The default answer
    default        = "A default answer",
    -- When hitting `tab`, will try to autocomplete based on those values
    possibleValues = {
        "some",
        "possible",
        "values",
    },
    -- Must return whether the current text is valid + a message in case it's not
    validator      = function(text)
        return text:match("[a-zA-Z]*"), "Message when not valid"
    end,
    -- If returns false, input will not appear at all
    filter         = function(input)
        return input:match("[a-zA-Z]*")
    end
}:ask() -- Returns the answer

Password

Password

Obfuscates the input.

Password {
    prompt = "Enter your secret (hidden answer)\n",
    -- When false *** are printed otherwise nothing
    hidden = false
}:ask() -- Returns the actual answer

Confirm

Confirm

A simple yes/no prompt.

Confirm {
    prompt = "All finished?"
}:ask() -- Returns the answer

List

Single Choice List

Multiple Choices List

Will choose the appropriate list (check list or radio list).

List {
    prompt   = "Where are you from?",
    -- If true can select multiple choices (check list) otherwise one (radio list)
    multiple = false,
    -- List of choices
    items    = {
        {
            -- The actual value returned if selected
            value = "New York",
            -- The value displayed to the user
            label = "New York"
        },
        {
            value = "Paris",
            label = "Paris"
        },
        {
            value = "Rome",
            label = "Rome"
        }
    },
    -- Indexes of already selected choices
    default  = { 2, 4 },
}:ask() -- Returns a table of the selected choices

Composite

Composite

Will jump from field to field when appropriate.

TODO: field's length should be optional

Composite {
    prompt = "What's your birthday? ",
    -- Separator between each fields
    separator = " / ",
    -- Fields definition
    fields = {
        {
            placeholder = "YYYY",
            filter = function(input)
                return input:match("%d")
                    and input
                    or ""
            end,
            -- Required
            length = 4,
        },
        {
            placeholder = "mm",
            filter = function(input)
                return input:match("%d")
                    and input
                    or ""
            end,
            length = 2,
        },
        {
            placeholder = "dd",
            filter = function(input)
                return input:match("%d")
                    and input
                    or ""
            end,
            length = 2,
        },
    }
}:ask() -- Returns a table of each field's answer
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].