Code Monkey home page Code Monkey logo

argparse's Introduction

argparse

Build Status

argparse - A command line arguments parsing library in C (compatible with C++).

Description

This module is inspired by parse-options.c (git) and python's argparse module.

Arguments parsing is common task in cli program, but traditional getopt libraries are not easy to use. This library provides high-level arguments parsing solutions.

The program defines what arguments it requires, and argparse will figure out how to parse those out of argc and argv, it also automatically generates help and usage messages and issues errors when users give the program invalid arguments.

Features

  • handles both optional and positional arguments
  • produces highly informative usage messages
  • issues errors when given invalid arguments

There are basically three types of options:

  • boolean options
  • options with mandatory argument
  • options with optional argument

There are basically two forms of options:

  • short option consist of one dash (-) and one alphanumeric character.
  • long option begin with two dashes (--) and some alphanumeric characters.

Short options may be bundled, e.g. -a -b can be specified as -ab.

Options are case-sensitive.

Options and non-option arguments can clearly be separated using the -- option.

Examples

argparse's People

Contributors

a-random-lemurian avatar aschuhardt avatar bunjdo avatar cofyc avatar cofyc-bot avatar david-croose avatar dumheter avatar eljefedelrodeodeljefe avatar falcosc avatar fluffyfoxuwu avatar foosoft avatar handledexception avatar pariasm avatar polluks avatar uis246 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.