This tool allows you to create interactive CLI prototypes using a simple JSON configuration file. It's designed to be easy to use, even for those with limited coding experience.
Usage
Define your CLI prototype in the commands.json file using the features described below. Open the HTML file in a web browser to interact with your CLI prototype.
This is a simulation tool and does not execute actual system commands. Some features (like custom output formatting) may require additional implementation in the JavaScript code.
The CLI prototype is configured using a commands.json
file. Here are the features available:
"commandName": {
"description": "Description of the command",
"action": "Output of the command"
}
Specify a color for the command output:
"action": "This will be green",
"color": "green"
Available colors: black, red, green, yellow, blue, magenta, cyan, white.
Add flags to your commands:
"flags": {
"--flagName": {
"description": "Description of the flag",
"requiresValue": true,
"aliases": ["-f"]
}
}
Create nested command structures:
"git": {
"description": "Version control system",
"subcommands": {
"commit": {
"description": "Record changes to the repository",
"action": "Changes committed successfully."
}
}
}
Define positional arguments for your commands:
"args": [
{
"name": "text",
"description": "The text to display"
}
]
Create interactive prompts:
"prompts": [
{
"name": "username",
"message": "Enter your username:"
},
{
"name": "password",
"message": "Enter your password:",
"hidden": true
}
]
Use conditions to determine command behavior:
"action": [
{
"if": "flags['--environment'] === 'production'",
"then": "Deploying to production...",
"else": "Deploying to {{flags['--environment']}}..."
}
]
Create alternative names for your commands:
"aliases": ["ls", "dir"]
Specify custom data and format (formatting to be implemented in JavaScript):
"action": {
"data": {
"cpu": "25%",
"memory": "4GB",
"disk": "120GB"
},
"format": "table"
}
Execute multiple actions in sequence:
"action": [
"Installing dependencies...",
{ "command": "echo", "args": ["Dependencies installed."] },
"Setup complete!"
]
Simulate time-consuming operations:
"action": [
{
"text": "Compiling source files...",
"delay": 2000
},
{
"text": "Build complete!",
"delay": 500
}
]
Show progress for long-running operations:
"action": [
{
"type": "progressBar",
"text": "Downloading:",
"duration": 5000
},
"Download complete!"
]
Display a spinner for indeterminate progress:
"action": [
{
"type": "spinner",
"text": "Processing data",
"duration": 3000
},
"Processing complete!"
]