GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - docopt/docopt.swift: A command-line interface description language and parser that will make you smile http://docopt.org/

BranchesTags
Open more actions menu

Latest commit

 

History

71 Commits
71 Commits

Folders and files

NameName
Last commit message
Last commit date
DocoptTests
DocoptTests
 
 
Examples
Examples
 
 
Sources
Sources
 
 
docopt.xcodeproj
docopt.xcodeproj
 
 
.gitignore
.gitignore
 
 
.swift-version
.swift-version
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 
docopt.podspec
docopt.podspec
 
 

Repository files navigation

build status docopt.swift is a Swift port of docopt

docopt.swift helps you create most beautiful command-line interfaces easily:

Swift:

let doc : String = """
Not a serious example.

Usage:
  calculator_example.py <value> ( ( + | - | * | / ) <value> )...
  calculator_example.py <function> <value> [( , <value> )]...
  calculator_example.py (-h | --help)
  
Examples:
  calculator_example.py 1 + 2 + 3 + 4 + 5
  calculator_example.py 1 + 2 '*' 3 / 4 - 5    # note quotes around '*'
  calculator_example.py sum 10 , 20 , 30 , 40
  
Options:
  -h, --help
"""

var args = Process.arguments
args.removeAtIndex(0) // arguments[0] is always the program_name
let result = Docopt.parse(doc, argv: args, help: true, version: "1.0")
println("Docopt result: \(result)")

Objective-C:

NSArray *arguments = [[NSProcessInfo processInfo] arguments];
arguments = arguments.count > 1 ? [arguments subarrayWithRange:NSMakeRange(1, arguments.count - 1)] : @[];

NSDictionary *result = [Docopt parse:doc argv:arguments help:YES version:@"1.0" optionsFirst:NO];
NSLog(@"Docopt result:\n%@", result);

Installation

Swift:

  • Check out docopt.swift
  • Add docopt folder to your project

Swift Package Manager:

.package(url: "https://github.com/docopt/docopt.swift", from: "0.6.6"),

Objective-C:

  • Check out docopt.swift
  • Build Docopt target
  • Add Docopt.framework to your project

License

docopt.swift is released under the MIT License.

About

A command-line interface description language and parser that will make you smile http://docopt.org/

Topics

argument-parsercommand-linedocoptswift

Resources

Readme
MIT license
Activity
Custom properties

Stars

52 stars

Watchers

9 watching

Forks

15 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.