Technology moves fast! ⚡ Don't get left behind.🚶 Subscribe to our mailing list to keep up with latest and greatest in open source projects! 🏆

Subscribe to our mailing list


command line arguments parser

Subscribe to updates I use DocOpt.jl

Statistics on DocOpt.jl

Number of watchers on Github 41
Number of open issues 4
Average time to close an issue 20 days
Main language Julia
Average time to merge a PR 2 days
Open pull requests 0+
Closed pull requests 0+
Last commit over 1 year ago
Repo Created over 5 years ago
Repo Last Updated over 1 year ago
Size 68 KB
Organization / Authordocopt
Latest Releasev0.3.0
Page Updated
Do you use DocOpt.jl? Leave a review!
View open issues (4)
View DocOpt.jl activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating DocOpt.jl for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


Build Status

DocOpt.jl is a port of docopt written in the Julia language.

docopt generates a command-line arguments parser from human-readable usage patterns.

You will find how attractive the idea of docopt is with the example below:

doc = """Naval Fate.

  naval_fate.jl ship new <name>...
  naval_fate.jl ship <name> move <x> <y> [--speed=<kn>]
  naval_fate.jl ship shoot <x> <y>
  naval_fate.jl mine (set|remove) <x> <y> [--moored|--drifting]
  naval_fate.jl -h | --help
  naval_fate.jl --version

  -h --help     Show this screen.
  --version     Show version.
  --speed=<kn>  Speed in knots [default: 10].
  --moored      Moored (anchored) mine.
  --drifting    Drifting mine.


using DocOpt  # import docopt function

args = docopt(doc, version=v"2.0.0")

The result is:

$ julia -qL examples/naval_fate.jl ship new FOO
julia> args
Dict{String,Any} with 15 entries:
  "remove"     => false
  "--help"     => false
  "<name>"     => String["FOO"]
  "--drifting" => false
  "mine"       => false
  "move"       => false
  "--version"  => false
  "--moored"   => false
  "<x>"        => nothing
  "ship"       => true
  "new"        => true
  "shoot"      => false
  "set"        => false
  "<y>"        => nothing
  "--speed"    => "10"

Julia v0.6 is now supported.


The DocOpt module exports just one function, docopt, which takes multiple arguments but all of them except the first one are optional.

docopt(doc::AbstractString, argv=ARGS; help=true, version=nothing, options_first=false, exit_on_error=true)


  • doc : Description of your command-line interface. (type: AbstractString)
  • argv : Argument vector to be parsed. (type: String or Vector{String}, default: ARGS)
  • help : Set to false to disable automatic help on -h or --help options. (type: Bool, default: true)
  • version : If passed, the value will be printed if --version is in argv. (any type, but VersionNumber is recommended, e.g. v1.0.2)
  • options_first : Set to true to require options precedes positional arguments, i.e. to forbid options and positional arguments intermix. (type: Bool, default: false)
  • exit_on_error : Set to true to print the usage and exit when parsing error happens. This option is for unit testing. (type: Bool, default: true)

doc argument is mandatory, argv argument is automatically set to command-line arguments, and help, version, options_first and exit_on_error are keyword arguments.


  • parsed arguemnts : An associative collection, where keys are names of command-line elements such as e.g. --verbose and , and values are the parsed values of those elements. (type: Dict{String,Any})

See for more details about the grammar of the usage pattern.

DocOpt.jl open issues Ask a question     (View All Issues)
  • over 3 years Should we use `Nullable` for optional arguments?
DocOpt.jl list of languages used
DocOpt.jl latest release notes
v0.3.0 Drop Julia 0.4 and 0.5

Now DocOpt.jl supports Julia 0.6 only.

  • Drop Julia 0.4 and 0.5 (#22).
v0.2.1 Support Julia 0.6
Other projects in Julia