Giter Club home page Giter Club logo

argpars's Introduction

argpars

Dependency-less, simple yet functional Command Line Argument Parser

Features

TODO

Usage

Basic usage (checkout the examples/usage.rs file for more information)

use argpars::*;

fn main() {
    let mut args: ArgsObj = Argpars::new();

    // Setting basic info about the app
    args.help_usage = format!("Usage: {} [OPTION]... [TEST]\n", args.arguments_passed[0]);
    args.help_name = "Test App".to_string();
    args.help_description = "This is a test description".to_string();
    args.help_version = "v1.0".to_string();

    // Adding arguments into the app
    args.add_argument("--print-stuff", "display \"stuff\"");

    // This is how you execute something when no arguments were passed
    if args.no_arguments_passed() {
        args.display_help_screen();
    }
    // This is how you ignore other arguments when the default (help, version) or wrong ones were passed
    else if args.default_arguments_passed() || args.wrong_arguments_passed() {
    }
    // Here you handle the rest of the arguments
    else {
        if args.passed("--print-stuff") {
            println!("stuff");
        }
    }

    // Executing Argpars parser and exiting from the app with a return value
    std::process::exit(args.pars());
}

LICENSE

This project is distributed under MIT license.

argpars's People

Contributors

ernest1338 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.