All Projects → nedpals → vargs

nedpals / vargs

Licence: MIT license
Simple argument parsing library for V.

Programming Languages

V
68 projects
AMPL
153 projects

Projects that are alternatives of or similar to vargs

termtable
Simple and highly customizable library to display tables in the terminal.
Stars: ✭ 41 (+13.89%)
Mutual labels:  v, vlang
registry
Package registry for vpkg
Stars: ✭ 13 (-63.89%)
Mutual labels:  v, vlang
jni
V wrapper around the C Java Native Interface
Stars: ✭ 15 (-58.33%)
Mutual labels:  v, vlang
vinix
Vinix is an effort to write a modern, fast, and useful operating system in the V programming language
Stars: ✭ 1,512 (+4100%)
Mutual labels:  v, vlang
vast
A simple tool for vlang, generate v source file to AST json file
Stars: ✭ 23 (-36.11%)
Mutual labels:  v, vlang
v-mode
🌻 An Emacs major mode for the V programming language.
Stars: ✭ 49 (+36.11%)
Mutual labels:  v, vlang
vave
🌊 A crazy simple library for reading/writing WAV files in V. Zero dependencies, 100% cross-platform.
Stars: ✭ 35 (-2.78%)
Mutual labels:  v, vlang
kate-syntax-highlight-v
Syntax highlighting of V files for the Kate editor
Stars: ✭ 17 (-52.78%)
Mutual labels:  v, vlang
discord.v
Discord Bot Framework written in V
Stars: ✭ 83 (+130.56%)
Mutual labels:  v, vlang
boundstone
High Performance / Fast Compilation / Lightweight MCBE Server
Stars: ✭ 42 (+16.67%)
Mutual labels:  v, vlang
vredis
Redis client for V, written in V
Stars: ✭ 43 (+19.44%)
Mutual labels:  v, vlang
v2048
A simple game of 2048, written in V.
Stars: ✭ 19 (-47.22%)
Mutual labels:  v, vlang
vbf
A brainfuck interpreter/compiler written in V.
Stars: ✭ 17 (-52.78%)
Mutual labels:  v, vlang
minesweeper-v
Minesweeper Written in Vlang
Stars: ✭ 19 (-47.22%)
Mutual labels:  v, vlang
CmdLine2
Command line argument parser (C++14)
Stars: ✭ 18 (-50%)
Mutual labels:  argument-parser
google-options
Command line argument parsing library from the folks at Google (java).
Stars: ✭ 61 (+69.44%)
Mutual labels:  argument-parser
jsonargparse
Implement minimal boilerplate CLIs derived from type hints and parse from command line, config files and environment variables
Stars: ✭ 168 (+366.67%)
Mutual labels:  argument-parser
argparse-to-class
Transform argparse into class format for Jupyter Notebook execution
Stars: ✭ 20 (-44.44%)
Mutual labels:  argument-parser
argparser
Simple command-line parser for C/C++ programs
Stars: ✭ 50 (+38.89%)
Mutual labels:  argument-parser
argparse
Parser for command-line arguments
Stars: ✭ 24 (-33.33%)
Mutual labels:  argument-parser

vargs 0.5

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 // or import nedpals.vargs for vpm users
import os

fn main() {
    // Second argument removes the first argument which contains the path of the executable.
    mut _args := vargs.new(os.args, 1)
    
    // Use the `alias` method if you want to map an option to an existing option.
    _args.alias('W', 'with')

    // Parsing is now a separate step
    _args.parse()

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

Installation

Via vpm:

v install nedpals.vargs

Via vpkg:

vpkg get vargs

# or

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

Changes in 0.5

  1. Breaking change on the usage of the library.
  2. alias(orig, dest) for mapping options to existing ones.
  3. Array and the start index are now moved into the Args struct as internal fields.
  4. Default values are now moved inside the declaration of the Args struct.

Changes in 0.4

  1. Use comma-separated values of an option as array of strings with the array_option(name) function
  2. Fixed unused variable error.
  3. Options values are now merged if the name of the option has already existed.
  4. Fixed problem when installing module from VPM. #2
  5. Final stable release? Hmmm

0.4.1

  1. Merge duplicate codes into a function.
  2. Fixed another unused variable error.

0.4.2

  1. Fixed parsing errors when used in complex scenarios.
  2. Add proper tests.
  3. Now only works with 0.1.22 and above.
  4. Fixed maps formatting when converting Args to string.
  5. Partial refactoring of code including converting if statements to match

0.4.3

  1. Fix breaking changes when compiling on V 0.1.23

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

Testing

To test the module, just type the following command:

v test vargs_test.v

License

MIT

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].