spyglass-cli

Crates.iospyglass-cli
lib.rsspyglass-cli
version0.1.0
sourcesrc
created_at2023-10-06 18:41:44.327832
updated_at2023-10-06 18:41:44.327832
description A cli tool designed to make substreams development a more ergonomic and type safe experience.
homepage
repository
max_upload_size
id995314
size461,346
HgCl2 (MercuricChloride)

documentation

README

Spyglass-CLI

Introduction

spyglass-cli is a command-line interface (CLI) tool written in Rust, designed to provide type-safe helpers for working with substreams, specifically when using substreams to sink into a subgraph. This tool lets users seamlessly integrate with and generate helpers from different formats such as .spkg and .graphql.

Features

  • Generate Rust code from .spkg and .graphql files.
  • Type-safe interactions with subgraphs, no more crashes at runtime!
  • Efficient schema parsing and code generation for GraphQL schemas.

Installation

To get started with spyglass-cli, make sure you have Rust and Cargo installed. If you haven't installed Rust, refer to the official installation guide.

Once Rust and Cargo are set up simply run:

$ cargo install spyglass-cli

Usage

Using spyglass-cli is straightforward. Here's a quick guide:

Generate Command

Generates Rust code from the provided .spkg or .graphql input file.

$ spyglass-cli generate <spkg_or_graphql_path> [--output-dir <output_directory>]
  • spkg_or_graphql_path: The path to the input .spkg or .graphql file.
  • --output-dir: (Optional) The directory where the generated Rust code will be saved. Defaults to ./src/spyglass/.

Examples:

To generate code from a .spkg file:

$ spyglass-cli generate /path/to/file.spkg

To generate code from a .graphql file and specify an output directory:

$ spyglass-cli generate /path/to/file.graphql --output-dir /desired/output/dir/

Dependencies

  • clap: For parsing and handling command line arguments.
  • nom: Used for working with byte-level and streaming data.
  • prost: A Protocol Buffers implementation for encoding/decoding.
  • anyhow: For easy error handling.
  • syn: A parsing library for Rust source code.
  • prettyplease: A utility for generating prettified Rust code.

Contribute

We welcome contributors to spyglass-cli! Feel free to fork the repository, make changes, and submit pull requests. Make sure to follow the Rust code guidelines and maintain the overall architecture and design of the tool.

About

Author: Alexander Gusev

Version: 0.1.0

Commit count: 0

cargo fmt