updated for required flags + TODO section
This commit is contained in:
parent
9ea1872f87
commit
c93be3493d
31
README.md
31
README.md
@ -20,6 +20,15 @@ This a very simple implementation of Go-like flags in Odin
|
||||
fleg.parse_flags()
|
||||
```
|
||||
|
||||
You can also marks flags as **required"**. These will still be parsed, however will hault the application until they are passed:
|
||||
|
||||
```odin
|
||||
import "fleg"
|
||||
isRunning: bool
|
||||
fleg.BoolVar(&isRunning, "isRunning", true, "A select piece of code is running!", required = true)
|
||||
fleg.parse_flags()
|
||||
```
|
||||
|
||||
***Supports: bool, int, string, f32***
|
||||
|
||||
And on the command line, you pass flags like so:
|
||||
@ -54,7 +63,20 @@ The package also contains a help context menu. This comes default and can be cal
|
||||
|
||||
## Custom Flag Format
|
||||
|
||||
A custom flag format can be created by overwriting the strings *FLAG_START_CHAR* and *FLAG_SEP_CHAR*. These cannot be the same however!
|
||||
A custom flag format can be created by overwriting the strings *FLAG_START_CHAR* and *FLAG_SEP_CHAR*. (These *cannot* be the same however!)
|
||||
|
||||
```odin
|
||||
fleg.FLAG_START_CHAR = "--"
|
||||
fleg.FLAG_SEP_CHAR = ":"
|
||||
```
|
||||
|
||||
Flags will now be in the format:
|
||||
|
||||
```txt
|
||||
--isString:"......"
|
||||
```
|
||||
|
||||
**Note:** Any change to the format of the flags is also relfected upon the "help" flag.
|
||||
|
||||
## Custom Allocator
|
||||
|
||||
@ -70,3 +92,10 @@ If needed, you are able to setup a custom allocator like so:
|
||||
fleg.init_custom_allocator(arena_alloc)
|
||||
defer fleg.destroy() //clean up flags
|
||||
```
|
||||
|
||||
## TODO
|
||||
|
||||
* More type support
|
||||
* Better logging of INFO and ERROR's
|
||||
* String validation (perhaps not needed?)
|
||||
* Array support (e.g. **--isArray:{4,5,6,7}**)
|
||||
Loading…
x
Reference in New Issue
Block a user