Coder Social home page Coder Social logo

odin-flag's People

Contributors

hrszpuk avatar

Watchers

 avatar

odin-flag's Issues

Better flag handling

Problem

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.

Add repository features to odin-flag

Todo list:

  • issue templates
  • pull request templates
  • Improved README.md (description, links, shields)
  • Improved bio (tags, better description)
  • Add DOCS.md (basic documentation)
  • Add release

Errors 101: kinds, handling, and reaction

Problem

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.

Potential Error Types

  • BadArgumentType: when a user supplies an argument with the wrong type
  • BadArgumentParsing: when a handler runs into issues with parsing (general)

Potential Error Reactions

  • ContinueOnError: ignore the error and continue parsing flags
  • ExitOnError: exit the program when encountering an issue
  • PanicOnError: panic when encountering an issue
  • CustomOnError: run a procedure when encountering an issue

Command, subcommands, and flag organisation

Problem

Many 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).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.