banchouboo / accord Goto Github PK
View Code? Open in Web Editor NEWA simple argument parser for Zig
License: The Unlicense
A simple argument parser for Zig
License: The Unlicense
Hello, thank you for the cool lib!
I was just testing some arguments to parse an ip + port when I run my main, but I couldn't manage to compile. I get the same results with the example code.
const allocator = std.heap.page_allocator;
var args_iterator = std.process.args();
const options = try accord.parse(&.{
accord.option('s', "string", []const u8, "default", .{}),
// accord.option('i', "ip", []const u8, "127.0.0.1", .{}),
// accord.option('p', "port", []const u8, "10002", .{}),
}, allocator, &args_iterator);
defer options.positionals.deinit(allocator);
Console logs:
xxxxxxx@xxxxxxx destral_zig % zig build
./src/accord/accord.zig:146:18: error: default_value of field 'string' is of type '?*const []const u8', expected '[]const u8' or '?[]const u8'
return @Type(struct_info);
^
./src/accord/accord.zig:231:114: note: called from here
pub fn parse(comptime options: []const Option, allocator: std.mem.Allocator, arg_iterator: anytype) !OptionStruct(options) {
^
./src/accord/accord.zig:231:114: note: called from here
pub fn parse(comptime options: []const Option, allocator: std.mem.Allocator, arg_iterator: anytype) !OptionStruct(options) {
^
./src/main.zig:526:29: note: called from here
pub fn main() anyerror!void {
^
zig_destral...The following command exited with error code 1:
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.