Commit Graph

206 Commits

Author SHA1 Message Date
Jimmi Holst Christensen
0970eb827f Fix long param parsing with '-' and '\_' in name 2022-03-24 11:08:21 +01:00
Jimmi Holst Christensen
b81787f02b Fix usage output in README 2022-03-23 21:48:20 +01:00
Jimmi Holst Christensen
5166a15378 Add parseParams and friends 2022-03-23 21:48:20 +01:00
Jimmi Holst Christensen
651dc2c3d6 Refactor parseParam into a state machine
This new parser stops when it hits something that looks like a new
parameter. This is the precurser to parsing multiple parameters in a
single function.
2022-03-23 21:48:20 +01:00
Jimmi Holst Christensen
dc70efb14f Workaround infinit loop caused by try inside inline for
fixes #72
2022-03-21 23:01:55 +01:00
Jimmi Holst Christensen
5f7b75d552 Allow for clap to parse argument values into types
This changes

- `.flag`, `.option`, `.options` and `.positionals` are now just fields
  you access on the result of `parse` and `parseEx`.
- `clap.ComptimeClap` has been removed.
- `clap.StreamingClap` is now called `clap.streaming.Clap`
- `parse` and `parseEx` now takes a `value_parsers` argument that
  provides the parsers to parse values.
- Remove `helpEx`, `helpFull`, `usageEx` and `usageFull`. They now just
  expect `Id` to have methods for getting the description and value
  texts.
2022-03-09 18:12:40 +01:00
dependabot[bot]
234af18c5a Bump actions/checkout from 2.4.0 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-02 17:56:40 +01:00
Jimmi Holst Christensen
c06c93608c Revert "Change clap into generating a struct"
This reverts commit cfaac64c40.
2022-02-25 19:44:52 +01:00
Jimmi Holst Christensen
cfaac64c40 Change clap into generating a struct
This changes

- `.flag`, `.option`, `.options` and `.positionals` are now just fields
  you access.
- Move the current `clap.parse` and friends into `clap.untyped.parse`
  - This is in preperation for `clap.typed.parse`
2022-02-25 19:40:00 +01:00
Jimmi Holst Christensen
2d9da16aa3 Fix minor typos in README.md 2022-02-22 19:19:25 +01:00
Jimmi Holst Christensen
a2af4a9267 Update package mod files to MIT 2022-02-03 21:59:50 +01:00
Jimmi Holst Christensen
7188a9fc85 Refactor the ArgIterator interface
They now follow the interface provided by the standard library. This now
means that we no longer needs `args.OsIterator` as that the one from
`std` can now be used directly.

Also remove `args.ShellIterator` as a simular iterator exists in `std`
called `ArgIteratorGeneral`.
2022-01-31 17:11:15 +01:00
Jimmi Holst Christensen
6a10b5f8ff Relicense to MIT
closes #64
2022-01-31 17:10:37 +01:00
Jimmi Holst Christensen
0b08e8e330 Avoid using the print API
The current Zig print API is quite good at slowing down compilation and
producing binary bloat. This commit makes an attempt to avoid using it
when not nessesary.
2022-01-05 17:58:07 +01:00
Jimmi Holst Christensen
802a04a854 Update usage of process.ArgIterator to be inline with newest zig
Also add windows CI, as this compiler error was only triggered on
windows builds
2021-12-29 12:05:23 +01:00
Komari Spaghetti
511b357b9f Tag 0.5.0 2021-12-21 23:17:46 +01:00
Komari Spaghetti
e522484eb4 Master branch now follows zig master
It makes more sense to have the master branch follow zig master, and
then create versioned branches to backport bug fixes to if nessesary
2021-12-21 23:15:26 +01:00
Komari Spaghetti
285fb8f5cc Merge branch 'zig-master' 2021-12-21 20:26:54 +01:00
Asherah Connor
cf8a34d11f
zig master updates: allocator changes (#60) 2021-12-06 10:18:55 +01:00
Jimmi Holst Christensen
b2059e5d08 Improve help and usage examples
Instead of just calling these function, have the examples be small
programs that demonstrates how you would actually use them together with
argument parsing.

fixes #57
2021-11-29 17:09:26 +01:00
Jimmi Holst Christensen
b34ab64c25 Fix chaining typo
fixes #58
2021-11-29 16:55:52 +01:00
dependabot[bot]
0925fbb492 Bump actions/checkout from 2.3.5 to 2.4.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.5 to 2.4.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.3.5...v2.4.0)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-03 16:08:42 +01:00
dependabot[bot]
09d8261653 Bump actions/checkout from 2.3.4 to 2.3.5
Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.3.5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2.3.4...v2.3.5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-18 22:26:01 +02:00
Komari Spaghetti
844c9370bc Fix regression in last commit
The importing of builtin was already fixed, so the latest commit applied
this fix again, which caused problems
2021-10-11 09:16:56 +02:00
Asherah Connor
7fe9b7c18c zig master updates 2021-10-11 09:15:17 +02:00
Komari Spaghetti
a791daf244 Merge branch 'master' into zig-master 2021-10-09 13:06:56 +02:00
Komari Spaghetti
bf94b097c4 Fix uses of builtin 2021-10-09 13:06:28 +02:00
Ryan Liptak
27899f951e Update mem.split call for latest zig master 2021-09-06 08:30:00 +02:00
Komari Spaghetti
eb81a66265 Merge branch 'master' into zig-master 2021-09-05 22:30:16 +02:00
Ryan Liptak
4be3fcdb61 Indent help text on every new line to allow for user-controlled wrapping 2021-09-05 22:29:35 +02:00
Stephen Gregoratto
c5fb22823a Update calls to tokenizer
The tokenize function was made generic, so we have to pass the type as
the first parameter.
2021-08-11 07:55:15 +02:00
Sirius902
ed90e560d9 Update CI to zig master 2021-07-25 22:22:22 +00:00
Sirius902
8b51a3d857 Discard unused variable 2021-07-25 22:22:22 +00:00
Komari Spaghetti
9bff7f332b Use debug.print instead of deprecated debug.warn in examples
fixes comment on #11
2021-07-17 10:43:05 +00:00
Komari Spaghetti
697d53fc7c Merge branch 'master' into zig-master 2021-07-17 10:26:51 +00:00
Komari Spaghetti
bb8a5ae5b9 Forward diagnostics down to StreamingClap
fixes #46
2021-07-16 15:13:57 +00:00
J.R. "hiljusti" Hill
f1c0a9fda6
Update example of usage (#45) 2021-07-06 09:00:25 +00:00
Komari Spaghetti
d02219c58f Fix all new compiler errors from zig master 2021-06-24 17:38:25 +02:00
Komari Spaghetti
e7822aaf17 Fix all new compiler errors from zig master 2021-06-24 17:36:35 +02:00
Komari Spaghetti
6338f21da9 Build buildscript with latest version of zig 2021-06-24 17:36:12 +02:00
Komari Spaghetti
a626b5abff Tag 0.4.1 2021-06-24 17:28:40 +02:00
Komari Spaghetti
9db6e56d16 Stay under 100 chars per line in all the code 2021-06-24 17:22:33 +02:00
Komari Spaghetti
fb2ee06520 parseParam: Set eval quota to std.math.maxInt(u32)
fixes #42 related #39
2021-06-24 17:20:53 +02:00
Komari Spaghetti
6406e5af89 parse: Copy in arena after using it in parseEx
fixes #43
2021-06-24 17:20:00 +02:00
Komari Spaghetti
869aca59c5 Tag 0.4.0 2021-06-05 14:59:18 +02:00
Komari Spaghetti
577aae9b4c ci: Use zig 0.8.0 2021-06-05 14:33:37 +02:00
Komari Spaghetti
c7d83fcce1 Update to latest zig in preperation for 0.8.0 2021-05-26 21:06:10 +02:00
Komari Spaghetti
bc32ab0459 Merge branch 'master' into zig-master 2021-05-26 20:46:23 +02:00
Komari Spaghetti
4c14bfd518 Modernize codebase
* Better naming for variables
* Follow naming style of enums
* Use `writer()` instead of `outStream()`
* Change many initializers to be a one liner
* Don't explicitly initialize fields to their default value
2021-05-08 18:08:52 +02:00
Komari Spaghetti
aa334d8c1d Refactor Diagnostic (and others) into a ParseOption struct
This allows for default arguments, which we can also extend without
breaking peoples code in the future. This is a breaking change right now
though.
2021-04-28 16:59:30 +02:00