hrszpuk / odin-flag Goto Github PK
View Code? Open in Web Editor NEWCommand-line flags package for odin
License: MIT License
Command-line flags package for odin
License: MIT License
Currently flags can only be in two different permutations: --flag=value
or --flag
.
This may cause issues the user was to mistype, and overall just isn't an ideal way to handle flags.
The parser should be able to handle any white space between the end of the flag name, the equals, and the value:
--flag=value
--flag= value
--flag =value
--flag value
--flag = value
...etc
The ability to exclude the equals (=) all together would also be a great addition.
Todo list:
Currently, if there are any issues during parsing, the library will ignore all issues and return as if nothing has happened.
For example, if your create an int flag, but the user gives a string, nothing will the parsed.
I think instead of ignoring parser issues, there should be a way for the library to store and return errors. This gives programs that are using the library the opportunity to react to invalid inputs.
BadArgumentType
: when a user supplies an argument with the wrong typeBadArgumentParsing
: when a handler runs into issues with parsing (general)ContinueOnError
: ignore the error and continue parsing flagsExitOnError
: exit the program when encountering an issuePanicOnError
: panic when encountering an issueCustomOnError
: run a procedure when encountering an issueMany programs use command and subcommands. The most relevant example being the odin compiler itself:
odin is a tool for managing Odin source code
Usage:
odin command [arguments]
Commands:
build compile directory of .odin files, as an executable.
one must contain the program's entry point, all must be in the same package.
run same as 'build', but also then runs the newly compiled executable.
check parse, and type check a directory of .odin files
strip-semicolon parse, type check, and remove unneeded semicolons from the entire program
test build and runs procedures with the attribute @(test) in the initial package
doc generate documentation on a directory of .odin files
version print version
report print information useful to reporting a bug
For further details on a command, invoke command help:
e.g. `odin build -help` or `odin help build`
Each command can have its own set of flags, but also share a set of flags (like with odin build
and oding run
).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.