lama2

command module
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

README

Lama2: Plain-text Powered REST API Client

About

Lama2 is a plain-text powered REST API client & manager built for serious engineering teams. Lama2 specifies the .l2 syntax for describing APIs, and implements a CLI to execute .l2 files. Engineers can collaborate on .l2 files using version control. Lama2 integrates nicely with IDEs and text-editors as well. Think of Lama2 as markdown for APIs.

Benefits

  1. Plain-text files: Store APIs in the plain-text .l2 API files. Simple and human-friendly syntax. Learn basics within minutes!
  2. Simple CLI: Launch the CLI tool l2 on API files to make REST API requests.
  3. Editor support: Invoke Lama2 from your favorite text editor or IDE. Helpful documentation and tool support to build editor extensions included.
  4. Longevity & track-ability: Commit .l2 files to git or other version control for long life & change tracking.
  5. Collaboration: Share API repo with teammates and colleagues to collaborate
  6. Documentation: Explore tutorials, how-tos, explanations, references, FAQ/RAQs, and diagrams. Documentation is a priority, so that you never have to get lost.
  7. Extensibility: .l2 syntax is implemented as a recursive descent parser, based on a clearly specified grammar. Dig into details and implement new syntax (ex: to support websockets)

Terminal Demo: A POST request

VSCode Demo: The same POST request

Installation

curl -s https://raw.githubusercontent.com/HexmosTech/Lama2/main/install.sh | bash -s

Learn more about other installation methods from our docs.

VSCode Extension

Find Lama2 for VSCode at the VSCode Marketplace. The extension requires the l2 command available (usually at /usr/local/bin/l2).

Design Philosophy

  1. Delegate subtasks to open and mature tools:
    1. API Collaboration - git
    2. API Organization - OS file system
    3. API Editing - VSCode/IDEs
    4. API Requests - HTTPie
  2. Start a language formalization effort from the beginning (learning from Markdown history)
  3. Keep language syntax simple
  4. Invest into good documentation
  5. Strive to keep components decoupled

General Usage

Simply type any of the following to get options (option support is in progress):

elf
elf -h 
elf --help

Find some sample request files in the sample_http folder.

Prettification

To fix messed up JSONs in place:

elf -p file.l2

Prettify all files in a directory (useful for large API collections such as FW-specific APIHub):

find . -type f -name "*.l2" -exec elf -p {} \
Installation

If you're on ubuntu, just run:

git clone git@gitlab.com:flyweightgroup/httpelf.git
./install.sh

This will install golang/httpie if necessary, build httpelf and finally move the binary into /usr/bin (/usr/local/bin in macOS)

Updates

If you're on ubuntu, just run:

git pull
./install.sh

Note: overwrites the existing binary in /usr/bin (/usr/local/bin in macOS)

FW-specific workflow

  1. Pull/Clone httpelf repo.

  2. Run `./install.sh (will update the binary if code has updated)

  3. Clone APIHub repo.

  4. Create a folder for your service (ex: impression_collector)

  5. Start defining *.l2 files for each service specific API.

  6. Use elf file.l2 to test the newly defined APIs.

  7. Push the API files once ready into APIHub repo

Development

Testing
go test -v

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
The `parser` package provides primitives that help with writing recursive descent parsers.
The `parser` package provides primitives that help with writing recursive descent parsers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL