Rust starter project for building CLI and libraries, with great CI

Overview

Using the starter project:

  • find where bumblefoot is and replace it with the name of your project. $ rg bumblefoot
  • This is a dual library and binary project and builds both by default.

Compile a CLI:

$ cargo build

Compile a library:

$ cargo build --no-default-features

Project structure

bin/
  cmd/
    default.rs    <-- the 'bare' command `$ bumblefoot`
    validate.rs   <-- `$bumblefoot validate`
  bumblefoot.rs       <-- main CLI routing logic, add new commands here declaratively
data.rs      <-- aka 'types.rs'
lib.rs       <-- export some public API
runner.rs    <-- implement some logic here

Simpler structure You can convert the project to be simpler and CLI only on account of power and flexibility.

  • Copy the contents of default.rs into bumblefoot.rs and rename into main.rs.
  • Drop main.rs under src/ and delete bin/.
  • Remove the [[features]] and [[bin]] sections from Cargo.toml
  • Fix use issues and stale code errors in main.rs.

This should be the result:

bumblefoot/
  main.rs       <-- main CLI routing logic + default command
  data.rs      <-- aka 'types.rs'
  lib.rs       <-- export some public API
  runner.rs    <-- implement some logic here

xtask You have xtask preconfigured. It's a best-practice, boilerplate code that allows you to use cargo xtask <your task>. A kind of rust-native make.

You can use it to codify any of your tasks for CI or development.

In it you have two tasks preconfigured:

  • dual - convert this crate to a dual build (library and CLI)
  • simple - convert this crate to a simple layout

These will work only when you're starting out because they apply fresh templated code. Once you start building, they'll probably not be useful anymore.







bumblefoot
🤠 bumblefoot
🤖 bumblefoot


🔑 Bumblefoot

🚀 Quick Start

Grab a release from releases, or install via Homebrew:

brew tap jondot/tap && brew install bumblefoot

Using bumblefoot

Thanks

To all Contributors - you make this happen, thanks!

Copyright

Copyright (c) 2021 @jondot. See LICENSE for further details.

You might also like...
A demo app covering building an eBPF load-balancer in Rust

eBPF Rust UDP LoadBalancer Demo This is an example of creating a UDP load-balancer in Rust as an eXpress Data Path (XDP) type eBPF program using the a

nAssets are Nova Finance’s framework for building programmable assets.
nAssets are Nova Finance’s framework for building programmable assets.

nAssets are Nova Finance’s framework for building programmable assets. nAssets can be used to tokenize and store collective forms of value while also instructing assets to yield, exchange or rebalance.

A frontend web compiler for building slim UIs.

Delgada ❗️ Warning: This is not production ready software and is in very active development. ❗️ What is Delgada? Delgada is a small frontend compiler

The Stage 2 building block to reach the dream of DSNs with Bitcoin DeFi

rust-nostr Intro A complete suite of nostr Bitcoin libraries that can be used to develop Decentralized Social Networks (DSN) with integrated Bitcoin f

A minimal template for building smart contracts with Cairo 1.0

Minimal Cairo 1.0 Template Built with auditless/cairo-template A minimal template for building smart contracts with Cairo 1.0 using the Quaireaux proj

Rust project for working with ETH - Ethereum transactions with Rust on Ganache and also deploy smart contracts :)

Just a test project to work with Ethereum but using Rust. I'm using plain Rust here, not Foundry. In future we will use Foundry. Hope you're already f

A prototype project integrating jni rust into Kotlin and using protobuf to make them work together

KotlinRustProto a prototype project integrating jni rust into Kotlin and using protobuf to make them work together How to start add a RPC call in Droi

A library to help you sew up your Ethereum project with Rust and just like develop in a common backend

SewUp Secondstate EWasm Utility Program, a library helps you sew up your Ethereum project with Rust and just like development in a common backend. The

HyperCube is a free and open source blockchain project for everyone to use.

XPZ Public Chain HyperCube is a free and open source blockchain project for everyone to use. 日本語 简体中文 正體中文 HyperCube Wiki Wha is HyperCube HyperCube i

Comments
  • show clap help text by default

    show clap help text by default

    add by default clap help text by adding AppSettings::ArgRequiredElseHelp to the app settings

    expected behavior:

    if running the binary without any command, show the --help automatically

    to keep the bumblefoot_lib usage example, I move the login to validate the cmd

    opened by kaplanelad 2
  • return exitcode instead of bool

    return exitcode instead of bool

    following #6 issue, i have change the cmd return value from bool to exitcode

    Also added the option to pass a custom message with different style depending on the exit code

    opened by kaplanelad 0
  • setup log level

    setup log level

    Implement support log level as part of the template. related issue #5

    1. add all the log-level options as a clap possible_values
    2. set info level as default
    3. override from an environment variable if LOG is exists

    flag:

    bumblefoot --log <LEVEL>
    

    Take from env:

    LOG=<LEVEL> bumblefoot 
    
    opened by kaplanelad 0
  • settup clap with ArgRequiredElseHelp

    settup clap with ArgRequiredElseHelp

    add by default clap help text by adding AppSettings::ArgRequiredElseHelp to the app settings

    If the user runs the binary without a required args, show the --help automatically.

    I removed the default run command under the default.rs; if the command is not given, we show the --help text automatically

    How to test, run the binary without any command

    cargo run
    # or
    target/debug/bumblefoot
    
    opened by kaplanelad 0
Owner
Rusty Ferris Club
A computer club for people who love Rust. We're also building stuff, and teaching each other stuff.
Rusty Ferris Club
Collect libraries and packages about cryptography in Rust.

Awesome Cryptography Rust Collect libraries and packages about cryptography in Rust. Collection Library Symmetric Public-key / Asymmetric One-way Hash

Rust Cryptography Community 282 Dec 25, 2022
Automated security testing for open source libraries and applications.

autovet continuously searches for security breaches in open source libraries and applications. Recently processed packages package version channel las

null 5 Aug 23, 2022
rust client libraries to deal with the current cardano mainnet (byron / cardano-sl)

Rust implementation of Cardano primitives, helpers, and related applications Cardano Rust is a modular toolbox of Cardano’s cryptographic primitives,

Input Output 275 Oct 9, 2022
rust-native-tls — Bindings for native TLS libraries

rust-native-tls Documentation An abstraction over platform-specific TLS implementations. Specifically, this crate uses SChannel on Windows (via the sc

Steven Fackler 371 Jan 8, 2023
A collection of libraries to be implemented for Automated Market Makers built in Sway.

?? ?? Executor AMM ?? ?? The Executor AMM is a reference implementation of Concentrated Liquidity in Sway. To run on the FuelVM many modifications had

Sway Libraries 54 Dec 21, 2022
Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana (WIP) ⛏👷🚧⚠️

Solana BPF Boilerplate Simple template for building smart contract(Rust) and RPC Client(web3.js) on Solana This boilerplate provides the following. Si

ono 6 Jan 30, 2022
`llm-chain` is a powerful rust crate for building chains in large language models allowing you to summarise text and complete complex tasks

llm-chain ?? llm-chain is a collection of Rust crates designed to help you work with Large Language Models (LLMs) more effectively. Our primary focus

Sobel IO 36 Apr 6, 2023
Kryptokrona SDK in Rust for building decentralized private communication and payment systems.

Kryptokrona Rust SDK Kryptokrona is a decentralized blockchain from the Nordic based on CryptoNote, which forms the basis for Monero, among others. Cr

null 5 May 25, 2023
Rust-native building blocks for the Cardano blockchain ecosystem

Pallas Rust-native building blocks for the Cardano blockchain ecosystem. Introduction Pallas is an expanding collection of modules that re-implements

null 78 Dec 6, 2022
Simple example for building a blockchain in Rust

rust-blockchain-example Simple example for building a blockchain in Rust Start using RUST_LOG=info cargo run This starts the client locally. The block

mario 51 Dec 31, 2022