feat: Add first modules
This adds the first modules blocks from the initial proof of concept, with basic docs. Currently missing is bundling and usage instructions
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# Logging
|
||||
|
||||
Provide logging helpers for structured logging
|
||||
|
||||
## Overview
|
||||
|
||||
Parse log level from text representation to level number
|
||||
|
||||
## Index
|
||||
|
||||
* [parse_log_level](#parse_log_level)
|
||||
* [log](#log)
|
||||
|
||||
### parse_log_level
|
||||
|
||||
Parse log level from text representation to level number
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Log level to parse
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* numeric log level
|
||||
|
||||
### log
|
||||
|
||||
Log output on a given level, checks if $LOG_LEVEL, if not set defaults to INFO
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (number): Numeric log level
|
||||
* **$2** (string): Message to output
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* Formatted log message with ANSI color codes
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
# Prompts
|
||||
|
||||
Inquirer.js inspired prompts
|
||||
|
||||
## Overview
|
||||
|
||||
Prompt for text
|
||||
|
||||
## Index
|
||||
|
||||
* [input](#input)
|
||||
* [confirm](#confirm)
|
||||
* [list](#list)
|
||||
* [checkbox](#checkbox)
|
||||
* [password](#password)
|
||||
* [editor](#editor)
|
||||
* [with_validate](#with_validate)
|
||||
* [validate_present](#validate_present)
|
||||
|
||||
### input
|
||||
|
||||
Prompt for text
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Phrase for promptint to text
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* Text as provided by user
|
||||
|
||||
### confirm
|
||||
|
||||
Show confirm dialog for yes/no
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Phrase for promptint to text
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* 0 for no, 1 for yes
|
||||
|
||||
### list
|
||||
|
||||
Renders a text based list of options that can be selected by the
|
||||
user using up, down and enter keys and returns the chosen option.
|
||||
Inspired by https://unix.stackexchange.com/questions/146570/arrow-key-enter-menu/415155#415155
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Phrase for promptint to text
|
||||
* **$2** (array): List of options (max 256)
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* selected index (0 for opt1, 1 for opt2 ...)
|
||||
|
||||
### checkbox
|
||||
|
||||
Render a text based list of options, where multiple can be selected by the
|
||||
user using up, down and enter keys and returns the chosen option.
|
||||
Inspired by https://unix.stackexchange.com/questions/146570/arrow-key-enter-menu/415155#415155
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Phrase for promptint to text
|
||||
* **$2** (array): List of options (max 256)
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* selected index (0 for opt1, 1 for opt2 ...)
|
||||
|
||||
### password
|
||||
|
||||
Show password prompt displaying stars for each password character letter typed
|
||||
it also allows deleting input
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Phrase for promptint to text
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* password as written by user
|
||||
|
||||
### editor
|
||||
|
||||
Open default editor
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Phrase for promptint to text
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* Text as input by user in input
|
||||
|
||||
### with_validate
|
||||
|
||||
Evaluate prompt command with validation, this prompts the user for input till the validation function
|
||||
returns with 0
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Prompt command to evaluate until validation is successful
|
||||
* #2 function validation callback (this is called once for exit code and once for status code)
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* Value collected by evaluating prompt
|
||||
|
||||
### validate_present
|
||||
|
||||
Validate a prompt returned any value
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (value): to validate
|
||||
|
||||
#### Output on stdout
|
||||
|
||||
* error message for user
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
# User-Feedback
|
||||
|
||||
Provides useful colored outputs for user feedback on actions
|
||||
|
||||
## Overview
|
||||
|
||||
Display error message in stderr, prefixed by check emoji
|
||||
|
||||
## Index
|
||||
|
||||
* [show_error](#show_error)
|
||||
* [show_success](#show_success)
|
||||
|
||||
### show_error
|
||||
|
||||
Display error message in stderr, prefixed by check emoji
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Error message to display
|
||||
|
||||
### show_success
|
||||
|
||||
Display success message in stderr, prefixed by cross emoji
|
||||
|
||||
#### Arguments
|
||||
|
||||
* **$1** (string): Success message to display
|
||||
|
||||
Reference in New Issue
Block a user