Skip to content

Commit

Permalink
Fixed Child Type Aliasing in Usage/Help Messages & Meta Doc Gen
Browse files Browse the repository at this point in the history
- Fixed aliased Usage/Help functions in `Options.zig`.
- Changed aliased names for Enum Types in `Value.zig`.
- Fixed Meta Doc Generators so they use a Value's Child Type Alias where appropriate.
  • Loading branch information
00JCIV00 committed Aug 26, 2024
1 parent e45e297 commit 9b0e6b0
Show file tree
Hide file tree
Showing 20 changed files with 169 additions and 127 deletions.
52 changes: 37 additions & 15 deletions examples/cova_demo_meta/arg_templates/covademo-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"short_name": 115,
"description": "A nested string option.",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
}
Expand Down Expand Up @@ -87,6 +88,7 @@
"short_name": 105,
"description": "Inheritable Option",
"type_name": "bool",
"type_alias": "toggle",
"set_behavior": "Last",
"max_entries": 1
}
Expand All @@ -109,8 +111,9 @@
{
"name": "in-bool",
"long_name": "in-bool",
"description": "The 'in_bool' Option of type 'bool'.",
"description": "The 'in_bool' Option of type 'toggle'.",
"type_name": "bool",
"type_alias": "toggle",
"set_behavior": "Last",
"max_entries": 1
},
Expand All @@ -137,72 +140,78 @@
{
"name": "str",
"long_name": "str",
"description": "The 'str' Option of type '?[]const u8'.",
"description": "The 'str' Option of type 'text'.",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "str2",
"long_name": "str2",
"description": "The 'str2' Option of type '?[]const u8'.",
"description": "The 'str2' Option of type 'text'.",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "flt",
"long_name": "flt",
"description": "The 'flt' Option of type '?f16'.",
"description": "The 'flt' Option of type 'f16'.",
"type_name": "f16",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "int2",
"long_name": "int2",
"description": "The 'int2' Option of type '?u16'.",
"description": "The 'int2' Option of type 'u16'.",
"type_name": "u16",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "multi-int",
"long_name": "multi-int",
"description": "The 'multi_int' Option of type '[3]?u8'.",
"description": "The 'multi_int' Option of type 'u8'.",
"type_name": "u8",
"set_behavior": "Multi",
"max_entries": 3
},
{
"name": "multi-str",
"long_name": "multi-str",
"description": "The 'multi_str' Option of type '[5]?[]const u8'.",
"description": "The 'multi_str' Option of type 'text'.",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Multi",
"max_entries": 5
},
{
"name": "rgb-enum",
"long_name": "rgb-enum",
"description": "The 'rgb_enum' Option of type '?covademo.DemoStruct.InnerEnum'.",
"description": "The 'rgb_enum' Option of type 'covademo.DemoStruct.InnerEnum'.",
"type_name": "u2",
"type_alias": "covademo.DemoStruct.InnerEnum",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "struct-bool",
"long_name": "struct-bool",
"description": "The 'struct_bool' Option of type 'bool'.",
"description": "The 'struct_bool' Option of type 'toggle'.",
"type_name": "bool",
"type_alias": "toggle",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "struct-str",
"long_name": "struct-str",
"description": "The 'struct_str' Option of type '[]const u8'.",
"description": "The 'struct_str' Option of type 'text'.",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
},
Expand Down Expand Up @@ -245,6 +254,7 @@
"short_name": 115,
"description": "The first String Value for the union-cmd.",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
}
Expand All @@ -261,6 +271,7 @@
"name": "union-str",
"description": "The 'union-str' Value of Type '[]const u8'.",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
}
Expand All @@ -282,6 +293,7 @@
"name": "val-01",
"description": "No description. (Descriptions cannot currently be generated from Function Parameters.)",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
}
Expand All @@ -296,25 +308,27 @@
"name": "fname",
"long_name": "fname",
"short_name": 102,
"description": "The 'fname' Option of type '?[]const u8'.",
"description": "The 'fname' Option of type 'text'.",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "lname",
"long_name": "lname",
"short_name": 108,
"description": "The 'lname' Option of type '?[]const u8'.",
"description": "The 'lname' Option of type 'text'.",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "age",
"long_name": "age",
"short_name": 97,
"description": "The 'age' Option of type '?u8'.",
"description": "The 'age' Option of type 'u8'.",
"type_name": "u8",
"set_behavior": "Last",
"max_entries": 1
Expand All @@ -323,16 +337,17 @@
"name": "admin",
"long_name": "admin",
"short_name": 65,
"description": "The 'admin' Option of type '?bool'.",
"description": "The 'admin' Option of type 'toggle'.",
"type_name": "bool",
"type_alias": "toggle",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "ref-ids",
"long_name": "ref-ids",
"short_name": 114,
"description": "The 'ref_ids' Option of type '[3]?u8'.",
"description": "The 'ref_ids' Option of type 'u8'.",
"type_name": "u8",
"set_behavior": "Multi",
"max_entries": 3
Expand Down Expand Up @@ -360,6 +375,7 @@
],
"group": "STRING",
"type_name": "[]const u8",
"type_alias": "string",
"set_behavior": "Multi",
"max_entries": 4
},
Expand Down Expand Up @@ -389,6 +405,7 @@
"description": "A filepath option.",
"group": "STRING",
"type_name": "[]const u8",
"type_alias": "filepath",
"set_behavior": "Last",
"max_entries": 1
},
Expand All @@ -399,6 +416,7 @@
"description": "An ordinal number option.",
"group": "STRING",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
},
Expand All @@ -422,6 +440,7 @@
],
"group": "BOOL",
"type_name": "bool",
"type_alias": "toggle",
"set_behavior": "Last",
"max_entries": 1
},
Expand All @@ -432,6 +451,7 @@
"description": "A toggle/boolean option.",
"group": "BOOL",
"type_name": "bool",
"type_alias": "toggle",
"set_behavior": "Last",
"max_entries": 1
},
Expand All @@ -451,13 +471,15 @@
"description": "A string value for the command.",
"group": "STRING",
"type_name": "[]const u8",
"type_alias": "text",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "cmd_bool",
"description": "A boolean value for the command.",
"type_name": "bool",
"type_alias": "toggle",
"set_behavior": "Multi",
"max_entries": 10
},
Expand Down
30 changes: 15 additions & 15 deletions examples/cova_demo_meta/arg_templates/covademo-template.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ cmd "nest-1" help="Nested Level 1." {

cmd "struct-cmd" help="A demo sub command made from a struct." {
flag "--int" help="The first Integer Value for the struct-cmd."
flag "--str" help="The 'str' Option of type '?[]const u8'."
flag "--str2" help="The 'str2' Option of type '?[]const u8'."
flag "--flt" help="The 'flt' Option of type '?f16'."
flag "--int2" help="The 'int2' Option of type '?u16'."
flag "--multi-int" help="The 'multi_int' Option of type '[3]?u8'."
flag "--multi-str" help="The 'multi_str' Option of type '[5]?[]const u8'."
flag "--rgb-enum" help="The 'rgb_enum' Option of type '?covademo.DemoStruct.InnerEnum'."
flag "--struct-bool" help="The 'struct_bool' Option of type 'bool'."
flag "--struct-str" help="The 'struct_str' Option of type '[]const u8'."
flag "--str" help="The 'str' Option of type 'text'."
flag "--str2" help="The 'str2' Option of type 'text'."
flag "--flt" help="The 'flt' Option of type 'f16'."
flag "--int2" help="The 'int2' Option of type 'u16'."
flag "--multi-int" help="The 'multi_int' Option of type 'u8'."
flag "--multi-str" help="The 'multi_str' Option of type 'text'."
flag "--rgb-enum" help="The 'rgb_enum' Option of type 'covademo.DemoStruct.InnerEnum'."
flag "--struct-bool" help="The 'struct_bool' Option of type 'toggle'."
flag "--struct-str" help="The 'struct_str' Option of type 'text'."
flag "--struct-int" help="The 'struct_int' Option of type 'i64'."

arg "multi-int-val" help="The 'multi-int-val' Value of Type '[2]u16'."

cmd "inner-cmd" help="An inner/nested command for struct-cmd" {
flag "--in-bool" help="The 'in_bool' Option of type 'bool'."
flag "--in-bool" help="The 'in_bool' Option of type 'toggle'."
flag "--in-float" help="The 'in_float' Option of type 'f32'."
}
}
Expand All @@ -78,11 +78,11 @@ cmd "fn-cmd" help="A demo sub command made from a function." {
}

cmd "add-user" help="A demo sub command for adding a user." {
flag "-f,--fname" help="The 'fname' Option of type '?[]const u8'."
flag "-l,--lname" help="The 'lname' Option of type '?[]const u8'."
flag "-a,--age" help="The 'age' Option of type '?u8'."
flag "-A,--admin" help="The 'admin' Option of type '?bool'."
flag "-r,--ref-ids" help="The 'ref_ids' Option of type '[3]?u8'."
flag "-f,--fname" help="The 'fname' Option of type 'text'."
flag "-l,--lname" help="The 'lname' Option of type 'text'."
flag "-a,--age" help="The 'age' Option of type 'u8'."
flag "-A,--admin" help="The 'admin' Option of type 'toggle'."
flag "-r,--ref-ids" help="The 'ref_ids' Option of type 'u8'."

arg "id" help="The 'id' Value of Type 'u16'."
}
16 changes: 8 additions & 8 deletions examples/cova_demo_meta/help_docs/manpages/covademo-add-user.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
.SH ARGUMENTS
.SS OPTIONS
.B fname:
[-f,--fname "fname ([]const u8)"]:
The 'fname' Option of type '?[]const u8'.
[-f,--fname "fname (text)"]:
The 'fname' Option of type 'text'.

.B lname:
[-l,--lname "lname ([]const u8)"]:
The 'lname' Option of type '?[]const u8'.
[-l,--lname "lname (text)"]:
The 'lname' Option of type 'text'.

.B age:
[-a,--age "age (u8)"]:
The 'age' Option of type '?u8'.
The 'age' Option of type 'u8'.

.B admin:
[-A,--admin "admin (bool)"]:
The 'admin' Option of type '?bool'.
[-A,--admin "admin (toggle)"]:
The 'admin' Option of type 'toggle'.

.B ref-ids:
[-r,--ref-ids "ref-ids (u8)"]:
The 'ref_ids' Option of type '[3]?u8'.
The 'ref_ids' Option of type 'u8'.

.SS VALUES
.B id:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(i32): No description. (Descriptions cannot currently be generated from Function Parameters.)

.B val-01:
([]const u8): No description. (Descriptions cannot currently be generated from Function Parameters.)
(text): No description. (Descriptions cannot currently be generated from Function Parameters.)


.SH AUTHOR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
.SH ARGUMENTS
.SS OPTIONS
.B in-bool:
[-null,--in-bool "in-bool (bool)"]:
The 'in_bool' Option of type 'bool'.
[-null,--in-bool "in-bool (toggle)"]:
The 'in_bool' Option of type 'toggle'.

.B in-float:
[-null,--in-float "in-float (f32)"]:
Expand Down
Loading

0 comments on commit 9b0e6b0

Please sign in to comment.