PitchHut logo
Rad
Modern CLI scripts made easy with Python-like syntax.
Pitch

Bash is powerful but painful. Rad gives you Python-like scripting with CLI superpowers built-in. Write maintainable scripts with declarative argument parsing, built-in JSON processing, HTTP requests, and intuitive user prompts. Transform how CLI tools are built with ease and efficiency.

Description

Rad is an innovative scripting language designed to provide the power of Bash with the simplicity and readability of Python. It addresses the challenges associated with traditional Bash scripts by offering built-in support for argument parsing, JSON processing, and HTTP requests, simplifying the scripting process for developers.

Key Features of Rad:

  • CLI-first Design: Rad is inherently designed for command-line operations, ensuring that argument validation and help commands are seamlessly integrated into the language.
  • Familiar Syntax: With syntax inspired by Python, Rad eliminates the complexity of Bash, making scripts easier to read and maintain.
  • Declarative Argument Handling: Automatic help generation, type-checking, validation, and parsing for arguments is built into the language, reducing the amount of boilerplate code necessary.
  • Simplified JSON Processing: Rad provides straightforward paths for extracting data from JSON, facilitating easy data manipulation and output formatting.
  • Built-in HTTP Support: Effortlessly query APIs and handle responses with minimal code required.
  • Interactive Prompts: Features like pick() and input() allow for simple user input handling and interactive menus, enhancing user experience.
  • Shell Command Execution: Enables execution of shell commands and capturing of their output within scripts.

Example Usage

Rad allows straightforward script writing that dramatically reduces the complexity typical of Bash. For instance, a script to fetch GitHub commits can be written as follows:

#!/usr/bin/env rad
args:
    repo str        # The repo to query. Format: user/project
    limit int = 20  # Max commits to return

url = "https://api.github.com/repos/{repo}/commits?per_page={limit}"

Time = json[].commit.author.date
Author = json[].commit.author.name
SHA = json[].sha

rad url:
    fields Time, Author, SHA

This Rad script fetches commit details without additional tools or complex commands, showcasing its efficiency and ease of use.

Comparison with Other Scripting Languages

Rad stacks up against Bash and Python in several key areas:

FeatureBashPythonRad
Syntax familiarityArchaic, hard to rememberFamiliarFamiliar (Python-like)
Argument parsingVerbose, manualargparse or librariesBuilt-in; declarative
Type checkingNoneManual or libraryBuilt-in
--help generationManualDependencies handle itBuilt-in; auto from comments
Validation/constraintsManualManual or library schemasBuilt-in (range, enum, etc)
JSON processingPipe to jqJSON module + manual handlingBuilt-in path syntax
HTTP requestscurl + pipesImport requestsBuilt-in; first-class support

Next Steps

Rad is currently in early development, with core features functioning effectively. It is continuously improved based on community feedback. Those interested in refining their scripting experience with fewer dependencies and more intuitive syntax will find value in trying Rad.

Documentation

For more information and a detailed "Getting Started" tutorial, please visit the official documentation.

0 comments

No comments yet.

Sign in to be the first to comment.