https://github.com/hrszpuk/odin-flag
Command-line flags package for odin
https://github.com/hrszpuk/odin-flag
command-line library odin odin-lang odin-programming-language package
Last synced: 3 months ago
JSON representation
Command-line flags package for odin
- Host: GitHub
- URL: https://github.com/hrszpuk/odin-flag
- Owner: hrszpuk
- License: mit
- Created: 2023-07-05T18:02:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-09T17:54:01.000Z (over 1 year ago)
- Last Synced: 2025-01-07T06:15:34.875Z (5 months ago)
- Topics: command-line, library, odin, odin-lang, odin-programming-language, package
- Language: Odin
- Homepage:
- Size: 160 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Odin-flag
A simple, easy to use command line flag parser for Odin.
Installation
User Guide
Contributing
```odin
package mainimport "core:fmt"
import flag "../.." // path to packagemain :: proc() {
using flagflags := flagset()
count := 1
send := false
msg: stringflags->add("count", &count, int)
flags->add("send", &send, bool)
flags->add("msg", &msg, string)flags->parse()
if send {
for _ in 0..free()
}
```
✨ For more examples see the User Guide ✨## Installation
The recommended way to install odin-flag is to use git submodules.In your project, create a directory called "external" (or alternative name) and run the command below.
```
git submodule add https://github.com/hrszpuk/odin-flag external/odin-flag
```
From your project directory you can access the library like in the code below.
```odin
package mainimport flag "external/odin-flag"
main :: proc() {
using flagflag := flagset()
// ...
flag->free()
}
```
**NOTE:** the path to odin-flag may be different depending on where odin-flag is installed and where you are trying to access odin-flag from.
Your first step to troubleshoot installation issues is to check where odin-flag is installed and where you are trying to access odin-flag from.## Contributing
If you wish to contribute new features, report/fix a bug, or discuss changes/additions to the product please create an issue.