Skip to content

Commit

Permalink
Fixed Doc Generation w/ custom Usage/Help Functions (BREAKING)
Browse files Browse the repository at this point in the history
- Changed the function signature for all custom Argument Usage/Help Functions to have a nullable Allocator (`?mem.Allocator`). This pushes the onus for dealing w/ comptime calls to the library user and allows these functions to still be called by the Meta Doc Generators as needed.
- Updated examples w/ this change.
  • Loading branch information
00JCIV00 committed Aug 25, 2024
1 parent 70dcc77 commit e45e297
Show file tree
Hide file tree
Showing 26 changed files with 178 additions and 200 deletions.
40 changes: 20 additions & 20 deletions examples/cova_demo_meta/arg_templates/covademo-template.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"Meta Info": {
"name": "covademo",
"description": "A demo of the Cova command line argument parser.",
"version": "0.10.0",
"ver_date": "06 APR 2024",
"version": "0.10.1",
"ver_date": "21 MAY 2024",
"author": "00JCIV00",
"copyright": "MIT License"
},
Expand Down Expand Up @@ -40,7 +40,7 @@
"long_name": "nested_str",
"short_name": 115,
"description": "A nested string option.",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
}
Expand Down Expand Up @@ -138,15 +138,15 @@
"name": "str",
"long_name": "str",
"description": "The 'str' Option of type '?[]const u8'.",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "str2",
"long_name": "str2",
"description": "The 'str2' Option of type '?[]const u8'.",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
},
Expand Down Expand Up @@ -178,7 +178,7 @@
"name": "multi-str",
"long_name": "multi-str",
"description": "The 'multi_str' Option of type '[5]?[]const u8'.",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Multi",
"max_entries": 5
},
Expand All @@ -202,7 +202,7 @@
"name": "struct-str",
"long_name": "struct-str",
"description": "The 'struct_str' Option of type '[]const u8'.",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
},
Expand All @@ -218,7 +218,7 @@
"vals": [
{
"name": "multi-int-val",
"description": "The 'multi-int-val' Value of type '[2]u16'.",
"description": "The 'multi-int-val' Value of Type '[2]u16'.",
"type_name": "u16",
"set_behavior": "Multi",
"max_entries": 2
Expand All @@ -244,23 +244,23 @@
"long_name": "str",
"short_name": 115,
"description": "The first String Value for the union-cmd.",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
}
],
"vals": [
{
"name": "union-uint",
"description": "The 'union-uint' Value of type 'u8'.",
"description": "The 'union-uint' Value of Type 'u8'.",
"type_name": "u8",
"set_behavior": "Last",
"max_entries": 1
},
{
"name": "union-str",
"description": "The 'union-str' Value of type '[]const u8'.",
"type_name": "text",
"description": "The 'union-str' Value of Type '[]const u8'.",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
}
Expand All @@ -281,7 +281,7 @@
{
"name": "val-01",
"description": "No description. (Descriptions cannot currently be generated from Function Parameters.)",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
}
Expand All @@ -297,7 +297,7 @@
"long_name": "fname",
"short_name": 102,
"description": "The 'fname' Option of type '?[]const u8'.",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
},
Expand All @@ -306,7 +306,7 @@
"long_name": "lname",
"short_name": 108,
"description": "The 'lname' Option of type '?[]const u8'.",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
},
Expand Down Expand Up @@ -341,7 +341,7 @@
"vals": [
{
"name": "id",
"description": "The 'id' Value of type 'u16'.",
"description": "The 'id' Value of Type 'u16'.",
"type_name": "u16",
"set_behavior": "Last",
"max_entries": 1
Expand All @@ -359,7 +359,7 @@
"text"
],
"group": "STRING",
"type_name": "string",
"type_name": "[]const u8",
"set_behavior": "Multi",
"max_entries": 4
},
Expand Down Expand Up @@ -388,7 +388,7 @@
"short_name": 70,
"description": "A filepath option.",
"group": "STRING",
"type_name": "filepath",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
},
Expand All @@ -398,7 +398,7 @@
"short_name": 111,
"description": "An ordinal number option.",
"group": "STRING",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
},
Expand Down Expand Up @@ -450,7 +450,7 @@
"name": "cmd_str",
"description": "A string value for the command.",
"group": "STRING",
"type_name": "text",
"type_name": "[]const u8",
"set_behavior": "Last",
"max_entries": 1
},
Expand Down
10 changes: 5 additions & 5 deletions examples/cova_demo_meta/arg_templates/covademo-template.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name "covademo"
bin "covademo"
about "A demo of the Cova command line argument parser."
version "0.10.0"
version "0.10.1"
author "00JCIV00"

flag "-s,--string" help="A string option. (Can be given up to 4 times.)"
Expand Down Expand Up @@ -56,7 +56,7 @@ cmd "struct-cmd" help="A demo sub command made from a struct." {
flag "--struct-str" help="The 'struct_str' Option of type '[]const u8'."
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'."
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'."
Expand All @@ -68,8 +68,8 @@ cmd "union-cmd" help="A demo sub command made from a union." {
flag "-i,--int" help="The first Integer Value for the union-cmd."
flag "-s,--str" help="The first String Value for the union-cmd."

arg "union-uint" help="The 'union-uint' Value of type 'u8'."
arg "union-str" help="The 'union-str' Value of type '[]const u8'."
arg "union-uint" help="The 'union-uint' Value of Type 'u8'."
arg "union-str" help="The 'union-str' Value of Type '[]const u8'."
}

cmd "fn-cmd" help="A demo sub command made from a function." {
Expand All @@ -84,5 +84,5 @@ cmd "add-user" help="A demo sub command for adding a user." {
flag "-A,--admin" help="The 'admin' Option of type '?bool'."
flag "-r,--ref-ids" help="The 'ref_ids' Option of type '[3]?u8'."

arg "id" help="The 'id' Value of type 'u16'."
arg "id" help="The 'id' Value of Type 'u16'."
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo-add-user 1 "06 APR 2024" "0.10.0"
.TH covademo-add-user 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo-add-user
Expand All @@ -13,11 +13,11 @@
.SH ARGUMENTS
.SS OPTIONS
.B fname:
[-f,--fname "fname (text)"]:
[-f,--fname "fname ([]const u8)"]:
The 'fname' Option of type '?[]const u8'.

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

.B age:
Expand All @@ -34,7 +34,7 @@

.SS VALUES
.B id:
(u16): The 'id' Value of type 'u16'.
(u16): The 'id' Value of Type 'u16'.


.SH AUTHOR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo-basic 1 "06 APR 2024" "0.10.0"
.TH covademo-basic 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo-basic
Expand Down
4 changes: 2 additions & 2 deletions examples/cova_demo_meta/help_docs/manpages/covademo-fn-cmd.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo-fn-cmd 1 "06 APR 2024" "0.10.0"
.TH covademo-fn-cmd 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo-fn-cmd
Expand All @@ -15,7 +15,7 @@
(i32): No description. (Descriptions cannot currently be generated from Function Parameters.)

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


.SH AUTHOR
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo-nest-1-nest-2 1 "06 APR 2024" "0.10.0"
.TH covademo-nest-1-nest-2 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo-nest-1-nest-2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo-nest-1 1 "06 APR 2024" "0.10.0"
.TH covademo-nest-1 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo-nest-1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo-struct-cmd-inner-cmd 1 "06 APR 2024" "0.10.0"
.TH covademo-struct-cmd-inner-cmd 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo-struct-cmd-inner-cmd
Expand Down
12 changes: 6 additions & 6 deletions examples/cova_demo_meta/help_docs/manpages/covademo-struct-cmd.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo-struct-cmd 1 "06 APR 2024" "0.10.0"
.TH covademo-struct-cmd 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo-struct-cmd
Expand All @@ -22,11 +22,11 @@ An inner/nested command for struct-cmd
The first Integer Value for the struct-cmd.

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

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

.B flt:
Expand All @@ -42,7 +42,7 @@ An inner/nested command for struct-cmd
The 'multi_int' Option of type '[3]?u8'.

.B multi-str:
[-null,--multi-str "multi-str (text)"]:
[-null,--multi-str "multi-str ([]const u8)"]:
The 'multi_str' Option of type '[5]?[]const u8'.

.B rgb-enum:
Expand All @@ -54,7 +54,7 @@ An inner/nested command for struct-cmd
The 'struct_bool' Option of type 'bool'.

.B struct-str:
[-null,--struct-str "struct-str (text)"]:
[-null,--struct-str "struct-str ([]const u8)"]:
The 'struct_str' Option of type '[]const u8'.

.B struct-int:
Expand All @@ -63,7 +63,7 @@ An inner/nested command for struct-cmd

.SS VALUES
.B multi-int-val:
(u16): The 'multi-int-val' Value of type '[2]u16'.
(u16): The 'multi-int-val' Value of Type '[2]u16'.


.SH AUTHOR
Expand Down
4 changes: 2 additions & 2 deletions examples/cova_demo_meta/help_docs/manpages/covademo-sub-cmd.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo-sub-cmd 1 "06 APR 2024" "0.10.0"
.TH covademo-sub-cmd 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo-sub-cmd
Expand All @@ -17,7 +17,7 @@
A nested integer option.

.B nested_str_opt:
[-s,--nested_str "nested_str_val (text)"]:
[-s,--nested_str "nested_str_val ([]const u8)"]:
A nested string option.

.SS VALUES
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo-union-cmd 1 "06 APR 2024" "0.10.0"
.TH covademo-union-cmd 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo-union-cmd
Expand All @@ -17,15 +17,15 @@
The first Integer Value for the union-cmd.

.B str:
[-s,--str "str (text)"]:
[-s,--str "str ([]const u8)"]:
The first String Value for the union-cmd.

.SS VALUES
.B union-uint:
(u8): The 'union-uint' Value of type 'u8'.
(u8): The 'union-uint' Value of Type 'u8'.

.B union-str:
(text): The 'union-str' Value of type '[]const u8'.
([]const u8): The 'union-str' Value of Type '[]const u8'.


.SH AUTHOR
Expand Down
10 changes: 5 additions & 5 deletions examples/cova_demo_meta/help_docs/manpages/covademo.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH covademo 1 "06 APR 2024" "0.10.0"
.TH covademo 1 "21 MAY 2024" "0.10.1"

.SH NAME
.B covademo
Expand Down Expand Up @@ -36,7 +36,7 @@ A demo sub command for adding a user.

.SS OPTIONS
.B string_opt:
[-s,--string "string_val (string)"]:
[-s,--string "string_val ([]const u8)"]:
A string option. (Can be given up to 4 times.)

.B int_opt:
Expand All @@ -48,11 +48,11 @@ A demo sub command for adding a user.
An float option. (Can be given up to 10 times.)

.B file_opt:
[-F,--file "filepath (filepath)"]:
[-F,--file "filepath ([]const u8)"]:
A filepath option.

.B ordinal_opt:
[-o,--ordinal "ordinal_val (text)"]:
[-o,--ordinal "ordinal_val ([]const u8)"]:
An ordinal number option.

.B cardinal_opt:
Expand All @@ -73,7 +73,7 @@ A demo sub command for adding a user.

.SS VALUES
.B cmd_str:
(text): A string value for the command.
([]const u8): A string value for the command.

.B cmd_bool:
(bool): A boolean value for the command.
Expand Down
Loading

0 comments on commit e45e297

Please sign in to comment.