Skip to content

inc0der/hxprompts

Repository files navigation

Haxe Externs for prompts

Prompts

Generated from @types/prompts v2.0.8 by dts2hx modified and maintained by @inc0der for use in @LunaTechsDev organization

Still in early development and may have inconsistencies

What is Prompts?

Prompts is a Lightweight, beautiful and user-friendly interactive prompts API that let' you enquire user's in your CLI application.

  • Simple: prompts has no big dependencies nor is it broken into a dozen tiny modules that only work well together.
  • User friendly: prompt uses layout and colors to create beautiful cli interfaces.
  • Promised: uses promises and async/await. No callback hell.
  • Flexible: all prompts are independent and can be used on their own.
  • Testable: provides a way to submit answers programmatically.
  • Unified: consistent experience across all prompts.

Dependencies

Installation

With lix:

lix install gh:inc0der/hxprompts

With Haxelib

haxelib git hxprompts https://github.com/inc0der/hxprompts.git master

Example

import prompts.Prompter;

class GuidedSetup {
  public static function main() {
    Prompter.call([
    {
       type: 'text',
       name: 'cwd',
       message: 'Where would you like to create the project?',
       initial: './',
       format: (v) -> Path.resolve(v)
     },
     {
       type: 'text',
       name: 'projectName',
       message: 'Project name',
       initial: 'generated-project'
     },
    ]).then((answers: Dynamic) -> {
      if (!FileSystem.exists(answers.cwd)) {
        FileSystem.createDirectory(answers.cwd);
        Sys.setCwd(answers.cwd);
      }
    })
  }
}

Contributors to @types/prompts

About

Haxe externs for prompts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages