Skip to content
V library for parsing arguments from argv-like arrays.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit Jun 29, 2019

v-args 0.2

V library for parsing arguments from argv-like arrays (like os.args). Ported from this file which was originally written on Typescript.

// dummy.v
import args
import os

fn main() {
    // Second argument removes the first argument which contains the path of the executable.
    _args := args.parse(os.args, 1)

    println('with? ${_args.options['with']}')
./dummy cook chicken --with love
# { command: cook, options: { "with" => "love" }, unknown: ["chicken"] }
# cook
# chicken
# with? love


  1. Clone the repo. (git clone args)
  2. Copy the folder inside the vlib folder.*

*Note: The vlib folder is located where your V compiler is also located.

Changes in 0.2

  1. Flag structs and it's related functions (such as get_flag() and get()) are removed. Replaced with maps.
  2. The parse function now accepts a second argument that removes the first n elements in the array. Helpful if you want to only parse arguments after the name of the app/executable. Otherwise, set it to 0.
  3. Major refactoring and fixing of the library.


  1. The version of this module will remain in 0.x.x unless the language API's are finalized and implemented.
  2. Options will turn into maps in the future once maps will be fully implemented in V.
  3. args.options.get_flag() returns the full Flag struct while args.options.get() returns the value of the specified option.


  1. Fork it (
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request




You can’t perform that action at this time.