Skip to content
Simple argument parsing library for V.
Verilog
Branch: master
Clone or download
Latest commit 5343376 Aug 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit Jun 29, 2019
README.md Update module name Aug 25, 2019
vargs.v Update module name Aug 25, 2019
vargs_test.v Update module name Aug 25, 2019

README.md

vargs 0.3

A simple argument parsing library for V. Ported from this file which was originally written on Typescript.

The version of this module will remain in 0.x.x unless the language API's are finalized and implemented.

// dummy.v
import vargs
import os

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

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

Installation

Via vpm:

v install nedpals.args

Via vpkg:

vpkg get vargs

# or

vpkg get https://github.com/nedpals/vargs

Breaking Changes in 0.3

  1. Module name renamed from args to vargs to avoid conflicts.
  2. 0.3 now requires V 0.1.18 and above because of the revised initialization of maps.
  3. Renaming of internal functions and better formatting when converting Args struct to string.
  4. Final stable release? Hmmm

Contributing

  1. Fork it (https://github.com/nedpals/vargs/fork)
  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

License

MIT

Contributors

You can’t perform that action at this time.