Coder Social home page Coder Social logo

intco / argparse Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saganov/argparse

0.0 1.0 0.0 46 KB

The PHP port of the Python argparse module that makes it easy to write user-friendly command-line interfaces.

License: MIT License

PHP 100.00%

argparse's Introduction

argparse

The PHP port of the Python argparse module that makes it easy to write user-friendly command-line interfaces.

Plant UML:

@startuml
interface IParser {
 +usage( format:String ) : String
 +help()
 +parse( args:Array ) : Array
 +value() : Array
 +key()
}

interface IArgument {
 +__toString() : String
}

abstract class Parser {
 #name : String
 #description : String
 #action : Callback
 #remainder : Array

 #arguments : Array

 +__construct( name:String, options:Array ) : Parser
 +__get( label:String ) : String
 +__isset( label:String ) : Boolean
 +__call( name:String, arguments:Array ) : IArgument | Mixed
 +__invoke( args:Array ) : Mixed

 +key() : String
 +next() : Int

 +help() : String

 +addArgument( argument:IArgument ) : IArgument

 #arguments( type:String ) : Array

 #array2string( data:Array, callback:Callback, wrapper:String ) : String
 #formatText( text:String, pad:String, wrap:Int ) : String

 #commandStore( argument, value ) : void
 +commandHelp()
}

class ArgumentParser {
 +__construct( name:String, options:Array ) : ArgumentParser

 +usage( format:String ) : String
 +parse( args:Array ) : Array
 +value() : Array

 +commandHelp()
}

class SubParsers {
 #parsers : Array
 #parser : Parser

 +__toString() : String
 +key()

 +usage() : String
 +help() : String
 +parse( args:Array ) : Array
 +value() : Array

 +addParser( parser:Parser ) : Parser
 +getParser( name:String ) : Parser

 +formatArgumentHelp( name:String, help:String, name_pad:String, help_pad:String, glue:String ) : String
}

class Argument {
 #name : String
 #value : String
 #action = 'store' : String|Callback
 #nargs  = 1 : Int
 #const
 #default
 #type     = 'string' : String
 #choices
 #required = true : Boolean
 #help     = '' : String
 #metavar
 #dest

 +__construct( name:String, options:Array ) : Argument
 +__toString() : String
 +__call( name:String, arguments:Array ) : IArgument | Mixed
 +key()

 +usage( format:String ) : String
 +help( format:String ) : String
 +parse( args:Array ) : Array
 +value() : Array

 +formatText( text:String, pad:String, wrap:Int ) : String

 +store( value ) : void
}

class Option {
 #required = false : Boolean
 #short = false : String
 #long : String

 +__construct( name:String, options:Array ) : Argument
 +key() : String | Arrray

 +usage( format:String ) : String
 +help( format:String ) : String
 +parse( args:Array ) : Array
}

IParser <|-- IArgument
IParser <|-- Parser
IArgument <|-- Argument
Argument <|-- Option
IArgument <|-- SubParsers
Parser <|-- ArgumentParser
Parser <|-- SubParsers
@enduml

Direct link to the UML schema: https://goo.gl/5Ehc3q

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.