Commit Graph

60 Commits (d8cce0a71dea287274d9f5c8fa204b67445ffeff)

Author SHA1 Message Date
lutherwenxu dadf147382 flag: implement *_opt() and *_multi()
It's very often that someone will need to process values that were not
provided separately (eg. generating a complex default value like in V).

This commit allows the user to call the *_opt() functions instead of
forcing them to provide some magical default values.

* flag: Implement int_multi(), float_multi() and string_multi()

These 3 functions are useful when the application expects a flag to be
repeated more than once.

A sample would be:
v -cflags someflag -cflags secondflag

This feature exposes the raw array that the flag parser internally keeps
and allow the application to parse it however they want instead of
dropping everything except the first element.

* flag: Add documentation

Add comments describing what *_opt() and *_multi() do.
2019-12-16 19:03:38 +03:00
Delyan Angelov ec15bfb7d1 v test v => v test-compiler 2019-12-01 12:50:13 +03:00
Alexander Medvednikov 7d924679a6 []: update all examples and tests 2019-11-14 10:00:22 +03:00
Alexander Medvednikov 96b530cf85 update [] 2019-11-14 09:53:05 +03:00
joe-conigliaro 59378dce46 compiler/vlib: replace substr/left/right with `[start..end]` everywhere 2019-10-27 10:03:15 +03:00
Delyan Angelov 366c50674c tooling: add tools/compare_v_performance_between_commits
easily compare v performance/size across commits.

* fix eprintln on linux (it now uses stderr, and flushes it).

* flag: cleaner usage information.
2019-09-28 14:17:16 +03:00
Vitor Oliveira 1a099c9284 vlib: fix several typos 2019-09-14 23:54:14 +03:00
Marco Böttcher c924a6cf00 flag: allow to define flags with abbreviation
* flag: allow to check the count of the free args to produce an error

* flag: allow to define flags with abbreviation

flags could be defined to use a single char as abbreviation like
'--output' or '-o'
'--help' or '-h'
2019-08-07 16:52:10 +02:00
Marco Böttcher ff730b4eb0 flag: allow to check the count of the free args to produce an error 2019-08-06 01:56:42 +02:00
Marco Böttcher cb9fb66ccf flag: added a simple command line parser 2019-07-12 15:47:27 +02:00