Uses an internal parser to read settings in the cleanest possible way.
Example:
s = ArgParseSettings()
                                                        | abind 0.1.3 R | |
| abind 0.1.4 R 0.1.0 | |
| abind 0.1.5 R 0.1.0 | |
| abind 0.1.6 R 0.1.0 | |
| abind 0.1.7 R 0.3.0 | |
| AcceptanceSampling 1.2.0 R 0.1.0 1.0.0 | |
| AcceptanceSampling 1.3.0 R 0.1.0 1.0.0 | |
| aCGH.Spline 1.1.0 rJava | |
| aCGH.Spline 1.1.1 rJava | |
| aCGH.Spline 1.1.2 rJava 0.1.0 | 
| require("pkg") | |
| myresolve() = Pkg.cd_pkgdir() do | |
| have = (String=>ASCIIString)[] | |
| reqs = Metadata.parse_requires("REQUIRE") | |
| Git.each_submodule(false) do pkg, path, sha1 | |
| if pkg != "METADATA" | |
| have[pkg] = sha1 | |
| end | |
| end | 
| # example 6: commands & subtables | |
| require("argparse.jl") | |
| import ArgParse.* | |
| function main(args) | |
| s = ArgParseSettings("argparse_example_6.jl", | |
| "Example 6 for argparse.jl: " * | |
| "commands and their associated subtables.") | 
| dl = [-0.654981, -0.93716 , -0.459534, -0.0961306] | |
| d = [1.03823, 1.00984, 1.30874 , 1.23003 , 1.98585] | |
| v = [0.878788, 0.550649, 1.32675, -0.0301826, -0.48512] | |
| # lines 174-178 of test/lapack.jl | |
| Ts = Tridiagonal(dl,d,dl) | |
| Fs = full(Ts) | |
| invFsv = Fs\v | |
| Tldlt = ldlt(Ts) | |
| x = Tldlt\v | 
| # example 1: minimal options/arguments, auto-generated help/version | |
| require("argparse.jl") | |
| import ArgParse.* | |
| function main(args) | |
| s = ArgParseSettings() | |
| s.prog = "argparse_example_1.jl" # program name (for usage & help screen) | 
| require("textwrap.jl") | |
| import TextWrap.* | |
| import OptionsMod.* | |
| text = "Julia is a high-level, high-performance dynamic programming language for technical computing, with syntax that is familiar to users of other technical computing environments. It provides a sophisticated compiler, distributed parallel execution, numerical accuracy, and an extensive mathematical function library." | |
| println("DEFAULT OPTIONS") | |
| println("-"^70) | |
| println_wrapped(text) | 
| load("fft_powers.jl") | |
| @assert fft_powers_approx([2,3,5], 37) == 40 | |
| @assert nextprod([2,3,5], 37) == 40 | |
| function bench_nextprod(ps, x) | |
| tm = 1000 | |
| t = Array(Float64, tm) | |
| for i = 1:tm | |
| t[i] = @elapsed nextprod(ps, x) | |
| end | 
| julia> load("flatten1d.jl") | |
| julia> a = [[randi(3) for k=1:3] for i=1:3, j=1:2] | |
| 3x2 Array{Int64,1} Array: | |
| [3, 1, 2] [1, 3, 3] | |
| [1, 1, 3] [2, 3, 3] | |
| [3, 1, 3] [3, 2, 2] | |
| julia> flatten1d(a) | |
| 18-element Int64 Array: | 
| typealias MatOrNothing{T} Union(AbstractMatrix{T}, Vector{None}, Nothing) | |
| my_func{T}(A::MatOrNothing{T}) = println("my_func ok") | |
| M = [1. 2. ; 3. 4.] | |
| my_func(M) # works | |
| my_func([]) # works | |
| my_func(nothing) # fails |