diff options
author | sanine <sanine.not@pm.me> | 2022-08-24 00:02:17 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-08-24 00:02:17 -0500 |
commit | 2cb3c3df4099297b0a0554bb482e2de04fe86b5c (patch) | |
tree | 7796b4064c16460d9d603707b5256027649aa8b6 /libs/cargs/docs | |
parent | 709e1b6e1ce86f8da4fc136747fcefbc6c6057bd (diff) |
add command-line arguments
Diffstat (limited to 'libs/cargs/docs')
-rw-r--r-- | libs/cargs/docs/_config.yml | 6 | ||||
-rw-r--r-- | libs/cargs/docs/_layouts/default.html | 42 | ||||
-rw-r--r-- | libs/cargs/docs/assets/css/default.css | 127 | ||||
-rw-r--r-- | libs/cargs/docs/assets/css/github.css | 209 | ||||
-rw-r--r-- | libs/cargs/docs/assets/css/monakai.css | 210 | ||||
-rw-r--r-- | libs/cargs/docs/assets/css/trac.css | 210 | ||||
-rw-r--r-- | libs/cargs/docs/assets/css/vim.css | 1 | ||||
-rw-r--r-- | libs/cargs/docs/assets/img/favicon.png | bin | 0 -> 1584 bytes | |||
-rw-r--r-- | libs/cargs/docs/assets/img/favicon.svg | 125 | ||||
-rw-r--r-- | libs/cargs/docs/build.md | 49 | ||||
-rw-r--r-- | libs/cargs/docs/embed.md | 47 | ||||
-rw-r--r-- | libs/cargs/docs/index.md | 129 | ||||
-rwxr-xr-x | libs/cargs/docs/reference/cag_option_fetch.md | 32 | ||||
-rwxr-xr-x | libs/cargs/docs/reference/cag_option_get.md | 26 | ||||
-rwxr-xr-x | libs/cargs/docs/reference/cag_option_get_index.md | 29 | ||||
-rwxr-xr-x | libs/cargs/docs/reference/cag_option_get_value.md | 27 | ||||
-rw-r--r-- | libs/cargs/docs/reference/cag_option_prepare.md | 30 | ||||
-rwxr-xr-x | libs/cargs/docs/reference/cag_option_print.md | 28 | ||||
-rw-r--r-- | libs/cargs/docs/reference/index.md | 30 |
19 files changed, 1357 insertions, 0 deletions
diff --git a/libs/cargs/docs/_config.yml b/libs/cargs/docs/_config.yml new file mode 100644 index 0000000..88f7fa8 --- /dev/null +++ b/libs/cargs/docs/_config.yml @@ -0,0 +1,6 @@ +defaults:
+ -
+ scope:
+ path: "" # an empty string here means all files in the project
+ values:
+ layout: "default"
\ No newline at end of file diff --git a/libs/cargs/docs/_layouts/default.html b/libs/cargs/docs/_layouts/default.html new file mode 100644 index 0000000..e326afd --- /dev/null +++ b/libs/cargs/docs/_layouts/default.html @@ -0,0 +1,42 @@ +<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>{{ page.title }} - cargs</title>
+ <meta name="description" content="{{ page.description }}" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link href="https://fonts.googleapis.com/css?family=Ubuntu+Mono" rel="stylesheet">
+ <link href="{{ site.baseurl }}/assets/css/default.css?v2" rel="stylesheet" type="text/css">
+ <link href="{{ site.baseurl }}/assets/css/monakai.css" rel="stylesheet" type="text/css">
+ <link rel="shortcut icon" href="{{ site.baseurl }}/assets/img/favicon.png">
+ <script async src="https://www.googletagmanager.com/gtag/js?id=UA-127837944-1"></script>
+ <script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', 'UA-127837944-1');
+ </script>
+ </head>
+ <body>
+ <header>
+ <div class="inner">
+ <a href="{{ site.baseurl }}{% link index.md %}" class="logo">cargs</a>
+ <nav>
+ <a href="{{ site.baseurl }}{% link build.md %}">build</a>
+ <a href="{{ site.baseurl }}{% link embed.md %}">embed</a>
+ <a href="{{ site.baseurl }}{% link reference/index.md %}">reference</a>
+ </nav>
+ </div>
+ </header>
+ <div class="main">
+ <div class="content">
+ <h1>{{ page.title }}</h1>
+ {{ content }}
+ </div>
+ </div>
+ </body>
+ <footer>
+ find this repository on <a href="https://github.com/likle/cargs/tree/master">github</a>
+ </footer>
+</html>
diff --git a/libs/cargs/docs/assets/css/default.css b/libs/cargs/docs/assets/css/default.css new file mode 100644 index 0000000..9389ca0 --- /dev/null +++ b/libs/cargs/docs/assets/css/default.css @@ -0,0 +1,127 @@ +html,
+body {
+ height: 100%;
+}
+
+body {
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
+ margin: auto;
+ padding: 20px;
+ padding: 0;
+ display: flex;
+ flex-flow: column;
+ background: #fafafa;
+ color: #22162B;
+}
+
+header {
+ text-align: right;
+ margin-bottom: 20px;
+ padding: 20px 20px;
+ font-family: 'Ubuntu Mono';
+ background: #451F55;
+ color: #F8C630;
+ border-bottom: 10px solid #724E91;
+}
+
+header .inner {
+ max-width: 800px;
+ margin: auto;
+}
+
+header .logo {
+ float: left;
+ vertical-align: middle;
+ display: inline-block;
+ font-weight: bold;
+ font-size: 32pt;
+ padding: 0;
+ margin-left: 10px;
+ line-height: 50px;
+}
+
+header nav {
+ line-height: 50px;
+}
+
+header a {
+ padding: 10px;
+ text-decoration: none;
+ font-weight: bold;
+ font-size: 18pt;
+ overflow: auto;
+ color: #E54F6D;;
+}
+
+.main {
+ flex: 1;
+}
+
+footer {
+ text-align: center;
+ margin-top: 50px;
+ padding: 40px 20px;
+ font-family: 'Ubuntu Mono';
+ background: #22162B;
+ color: #F8C630;
+}
+
+
+a {
+ color: #E54F6D;
+}
+
+h1, h2 {
+ font-family: 'Ubuntu Mono';
+ padding-bottom: 5px;
+ border-bottom: 1px solid rgba(255,255,255,.2);
+}
+
+.content {
+ color: #49483e;
+ padding-top: 20px;
+ max-width: 800px;
+ margin: auto;
+}
+
+.highlight {
+ padding: 10px;
+ margin: 0;
+ overflow: auto;
+ white-space: pre-wrap;
+}
+
+.highlighter-rouge {
+ background: rgba(0,0,0,0.1);
+}
+
+table {
+ border-collapse: collapse;
+}
+
+table td,
+table th {
+ border: 1px solid #DDDDDD;
+ background: #ffffff;
+ padding: 5px 8px;
+}
+
+table tr:nth-child(even) td {
+ background: #f8f9fb;
+}
+
+@media (max-width: 1000px) {
+ header {
+ text-align: center;
+ }
+
+ header .logo {
+ display: block;
+ float: none;
+ margin-bottom: 10px;
+ }
+
+ .content {
+ padding: 0 20px;
+ }
+}
diff --git a/libs/cargs/docs/assets/css/github.css b/libs/cargs/docs/assets/css/github.css new file mode 100644 index 0000000..daf76ad --- /dev/null +++ b/libs/cargs/docs/assets/css/github.css @@ -0,0 +1,209 @@ +.highlight table td { padding: 5px; } +.highlight table pre { margin: 0; } +.highlight .cm { + color: #999988; + font-style: italic; +} +.highlight .cp { + color: #999999; + font-weight: bold; +} +.highlight .c1 { + color: #999988; + font-style: italic; +} +.highlight .cs { + color: #999999; + font-weight: bold; + font-style: italic; +} +.highlight .c, .highlight .cd { + color: #999988; + font-style: italic; +} +.highlight .err { + color: #a61717; + background-color: #e3d2d2; +} +.highlight .gd { + color: #000000; + background-color: #ffdddd; +} +.highlight .ge { + color: #000000; + font-style: italic; +} +.highlight .gr { + color: #aa0000; +} +.highlight .gh { + color: #999999; +} +.highlight .gi { + color: #000000; + background-color: #ddffdd; +} +.highlight .go { + color: #888888; +} +.highlight .gp { + color: #555555; +} +.highlight .gs { + font-weight: bold; +} +.highlight .gu { + color: #aaaaaa; +} +.highlight .gt { + color: #aa0000; +} +.highlight .kc { + color: #000000; + font-weight: bold; +} +.highlight .kd { + color: #000000; + font-weight: bold; +} +.highlight .kn { + color: #000000; + font-weight: bold; +} +.highlight .kp { + color: #000000; + font-weight: bold; +} +.highlight .kr { + color: #000000; + font-weight: bold; +} +.highlight .kt { + color: #445588; + font-weight: bold; +} +.highlight .k, .highlight .kv { + color: #000000; + font-weight: bold; +} +.highlight .mf { + color: #009999; +} +.highlight .mh { + color: #009999; +} +.highlight .il { + color: #009999; +} +.highlight .mi { + color: #009999; +} +.highlight .mo { + color: #009999; +} +.highlight .m, .highlight .mb, .highlight .mx { + color: #009999; +} +.highlight .sb { + color: #d14; +} +.highlight .sc { + color: #d14; +} +.highlight .sd { + color: #d14; +} +.highlight .s2 { + color: #d14; +} +.highlight .se { + color: #d14; +} +.highlight .sh { + color: #d14; +} +.highlight .si { + color: #d14; +} +.highlight .sx { + color: #d14; +} +.highlight .sr { + color: #009926; +} +.highlight .s1 { + color: #d14; +} +.highlight .ss { + color: #990073; +} +.highlight .s { + color: #d14; +} +.highlight .na { + color: #008080; +} +.highlight .bp { + color: #999999; +} +.highlight .nb { + color: #0086B3; +} +.highlight .nc { + color: #445588; + font-weight: bold; +} +.highlight .no { + color: #008080; +} +.highlight .nd { + color: #3c5d5d; + font-weight: bold; +} +.highlight .ni { + color: #800080; +} +.highlight .ne { + color: #990000; + font-weight: bold; +} +.highlight .nf { + color: #990000; + font-weight: bold; +} +.highlight .nl { + color: #990000; + font-weight: bold; +} +.highlight .nn { + color: #555555; +} +.highlight .nt { + color: #000080; +} +.highlight .vc { + color: #008080; +} +.highlight .vg { + color: #008080; +} +.highlight .vi { + color: #008080; +} +.highlight .nv { + color: #008080; +} +.highlight .ow { + color: #000000; + font-weight: bold; +} +.highlight .o { + color: #000000; + font-weight: bold; +} +.highlight .w { + color: #bbbbbb; +} +.highlight { + background-color: #f8f8f8; +} diff --git a/libs/cargs/docs/assets/css/monakai.css b/libs/cargs/docs/assets/css/monakai.css new file mode 100644 index 0000000..667b3ec --- /dev/null +++ b/libs/cargs/docs/assets/css/monakai.css @@ -0,0 +1,210 @@ +.highlight table td { padding: 5px; } +.highlight table pre { margin: 0; } +.highlight .c, .highlight .cd { + color: #75715e; + font-style: italic; +} +.highlight .cm { + color: #75715e; + font-style: italic; +} +.highlight .c1 { + color: #75715e; + font-style: italic; +} +.highlight .cp { + color: #75715e; + font-weight: bold; +} +.highlight .cs { + color: #75715e; + font-weight: bold; + font-style: italic; +} +.highlight .err { + color: #960050; + background-color: #1e0010; +} +.highlight .gi { + color: #ffffff; + background-color: #324932; +} +.highlight .gd { + color: #ffffff; + background-color: #493131; +} +.highlight .ge { + color: #000000; + font-style: italic; +} +.highlight .gr { + color: #aa0000; +} +.highlight .gt { + color: #aa0000; +} +.highlight .gh { + color: #999999; +} +.highlight .go { + color: #888888; +} +.highlight .gp { + color: #ee7733; +} +.highlight .gs { + font-weight: bold; +} +.highlight .gu { + color: #aaaaaa; +} +.highlight .k, .highlight .kv { + color: #66d9ef; + font-weight: bold; +} +.highlight .kc { + color: #66d9ef; + font-weight: bold; +} +.highlight .kd { + color: #66d9ef; + font-weight: bold; +} +.highlight .kp { + color: #66d9ef; + font-weight: bold; +} +.highlight .kr { + color: #66d9ef; + font-weight: bold; +} +.highlight .kt { + color: #66d9ef; + font-weight: bold; +} +.highlight .kn { + color: #f92672; + font-weight: bold; +} +.highlight .ow { + color: #f92672; + font-weight: bold; +} +.highlight .o { + color: #f92672; + font-weight: bold; +} +.highlight .mf { + color: #ae81ff; +} +.highlight .mh { + color: #ae81ff; +} +.highlight .il { + color: #ae81ff; +} +.highlight .mi { + color: #ae81ff; +} +.highlight .mo { + color: #ae81ff; +} +.highlight .m, .highlight .mb, .highlight .mx { + color: #ae81ff; +} +.highlight .se { + color: #ae81ff; +} +.highlight .sb { + color: #e6db74; +} +.highlight .sc { + color: #e6db74; +} +.highlight .sd { + color: #e6db74; +} +.highlight .s2 { + color: #e6db74; +} +.highlight .sh { + color: #e6db74; +} +.highlight .si { + color: #e6db74; +} +.highlight .sx { + color: #e6db74; +} +.highlight .sr { + color: #e6db74; +} +.highlight .s1 { + color: #e6db74; +} +.highlight .ss { + color: #e6db74; +} +.highlight .s { + color: #e6db74; +} +.highlight .na { + color: #a6e22e; +} +.highlight .nc { + color: #a6e22e; + font-weight: bold; +} +.highlight .nd { + color: #a6e22e; + font-weight: bold; +} +.highlight .ne { + color: #a6e22e; + font-weight: bold; +} +.highlight .nf { + color: #a6e22e; + font-weight: bold; +} +.highlight .no { + color: #66d9ef; +} +.highlight .bp { + color: #f8f8f2; +} +.highlight .nb { + color: #f8f8f2; +} +.highlight .ni { + color: #f8f8f2; +} +.highlight .nn { + color: #f8f8f2; +} +.highlight .vc { + color: #f8f8f2; +} +.highlight .vg { + color: #f8f8f2; +} +.highlight .vi { + color: #f8f8f2; +} +.highlight .nv { + color: #f8f8f2; +} +.highlight .w { + color: #f8f8f2; +} +.highlight .nl { + color: #f8f8f2; + font-weight: bold; +} +.highlight .nt { + color: #f92672; +} +.highlight { + color: #f8f8f2; + background-color: #49483e; +} diff --git a/libs/cargs/docs/assets/css/trac.css b/libs/cargs/docs/assets/css/trac.css new file mode 100644 index 0000000..854cfb8 --- /dev/null +++ b/libs/cargs/docs/assets/css/trac.css @@ -0,0 +1,210 @@ +.highlight table td { padding: 5px; } +.highlight table pre { margin: 0; } +.highlight .c, .highlight .cd { + color: #75715e; + font-style: italic; +} +.highlight .cm { + color: #75715e; + font-style: italic; +} +.highlight .c1 { + color: #75715e; + font-style: italic; +} +.highlight .cp { + color: #75715e; + font-weight: bold; +} +.highlight .cs { + color: #75715e; + font-weight: bold; + font-style: italic; +} +.highlight .err { + color: #960050; + background-color: #1e0010; +} +.highlight .gi { + color: #ffffff; + background-color: #324932; +} +.highlight .gd { + color: #ffffff; + background-color: #493131; +} +.highlight .ge { + color: #000000; + font-style: italic; +} +.highlight .gr { + color: #aa0000; +} +.highlight .gt { + color: #aa0000; +} +.highlight .gh { + color: #999999; +} +.highlight .go { + color: #888888; +} +.highlight .gp { + color: #555555; +} +.highlight .gs { + font-weight: bold; +} +.highlight .gu { + color: #aaaaaa; +} +.highlight .k, .highlight .kv { + color: #66d9ef; + font-weight: bold; +} +.highlight .kc { + color: #66d9ef; + font-weight: bold; +} +.highlight .kd { + color: #66d9ef; + font-weight: bold; +} +.highlight .kp { + color: #66d9ef; + font-weight: bold; +} +.highlight .kr { + color: #66d9ef; + font-weight: bold; +} +.highlight .kt { + color: #66d9ef; + font-weight: bold; +} +.highlight .kn { + color: #f92672; + font-weight: bold; +} +.highlight .ow { + color: #f92672; + font-weight: bold; +} +.highlight .o { + color: #f92672; + font-weight: bold; +} +.highlight .mf { + color: #ae81ff; +} +.highlight .mh { + color: #ae81ff; +} +.highlight .il { + color: #ae81ff; +} +.highlight .mi { + color: #ae81ff; +} +.highlight .mo { + color: #ae81ff; +} +.highlight .m, .highlight .mb, .highlight .mx { + color: #ae81ff; +} +.highlight .se { + color: #ae81ff; +} +.highlight .sb { + color: #e6db74; +} +.highlight .sc { + color: #e6db74; +} +.highlight .sd { + color: #e6db74; +} +.highlight .s2 { + color: #e6db74; +} +.highlight .sh { + color: #e6db74; +} +.highlight .si { + color: #e6db74; +} +.highlight .sx { + color: #e6db74; +} +.highlight .sr { + color: #e6db74; +} +.highlight .s1 { + color: #e6db74; +} +.highlight .ss { + color: #e6db74; +} +.highlight .s { + color: #e6db74; +} +.highlight .na { + color: #a6e22e; +} +.highlight .nc { + color: #a6e22e; + font-weight: bold; +} +.highlight .nd { + color: #a6e22e; + font-weight: bold; +} +.highlight .ne { + color: #a6e22e; + font-weight: bold; +} +.highlight .nf { + color: #a6e22e; + font-weight: bold; +} +.highlight .no { + color: #66d9ef; +} +.highlight .bp { + color: #f8f8f2; +} +.highlight .nb { + color: #f8f8f2; +} +.highlight .ni { + color: #f8f8f2; +} +.highlight .nn { + color: #f8f8f2; +} +.highlight .vc { + color: #f8f8f2; +} +.highlight .vg { + color: #f8f8f2; +} +.highlight .vi { + color: #f8f8f2; +} +.highlight .nv { + color: #f8f8f2; +} +.highlight .w { + color: #f8f8f2; +} +.highlight .nl { + color: #f8f8f2; + font-weight: bold; +} +.highlight .nt { + color: #f92672; +} +.highlight { + color: #f8f8f2; + background-color: #49483e; +} diff --git a/libs/cargs/docs/assets/css/vim.css b/libs/cargs/docs/assets/css/vim.css new file mode 100644 index 0000000..75e00ef --- /dev/null +++ b/libs/cargs/docs/assets/css/vim.css @@ -0,0 +1 @@ +unknown theme: vim diff --git a/libs/cargs/docs/assets/img/favicon.png b/libs/cargs/docs/assets/img/favicon.png Binary files differnew file mode 100644 index 0000000..b4d46f6 --- /dev/null +++ b/libs/cargs/docs/assets/img/favicon.png diff --git a/libs/cargs/docs/assets/img/favicon.svg b/libs/cargs/docs/assets/img/favicon.svg new file mode 100644 index 0000000..acf0df6 --- /dev/null +++ b/libs/cargs/docs/assets/img/favicon.svg @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="48" + height="48" + viewBox="0 0 12.7 12.7" + version="1.1" + id="svg8" + inkscape:version="0.92.3 (2405546, 2018-03-11)" + sodipodi:docname="favicon.svg"> + <defs + id="defs2"> + <inkscape:path-effect + effect="powerstroke" + id="path-effect845" + is_visible="true" + offset_points="0,0.13229166" + sort_points="true" + interpolator_type="CubicBezierJohan" + interpolator_beta="0.2" + start_linecap_type="zerowidth" + linejoin_type="extrp_arc" + miter_limit="4" + end_linecap_type="zerowidth" /> + <inkscape:path-effect + effect="spiro" + id="path-effect843" + is_visible="true" /> + <inkscape:path-effect + effect="simplify" + id="path-effect841" + is_visible="true" + steps="1" + threshold="0.00707113" + smooth_angles="360" + helper_size="0" + simplify_individual_paths="false" + simplify_just_coalesce="false" + simplifyindividualpaths="false" + simplifyJustCoalesce="false" /> + <inkscape:path-effect + effect="spiro" + id="path-effect837" + is_visible="true" /> + <inkscape:path-effect + effect="simplify" + id="path-effect835" + is_visible="true" + steps="1" + threshold="0.00707113" + smooth_angles="360" + helper_size="0" + simplify_individual_paths="false" + simplify_just_coalesce="false" + simplifyindividualpaths="false" + simplifyJustCoalesce="false" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="7.9195959" + inkscape:cx="40.669189" + inkscape:cy="15.472538" + inkscape:document-units="mm" + inkscape:current-layer="layer1" + showgrid="false" + units="px" + inkscape:window-width="1600" + inkscape:window-height="847" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" /> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-284.3)"> + <circle + style="opacity:0.98999999;fill:#646464;fill-opacity:1;stroke:none;stroke-width:0.99925655;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal" + id="path815" + cx="6.3499999" + cy="290.64999" + r="6.3499999" /> + <path + style="opacity:0.98999999;fill:#464646;fill-opacity:1;stroke:none;stroke-width:11.34266472;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal" + d="M 45.214844 12.810547 C 39.930389 15.838245 31.937362 19.593748 21.265625 22.328125 C 13.923958 24.209271 11.586387 22.779846 5.6914062 16.884766 C 4.3495394 15.542904 2.7438777 15.778452 1.0644531 16.9375 A 24 24 0 0 0 0 24 A 24 24 0 0 0 4.546875 38.005859 C 7.0755777 33.407331 11.162743 28.341891 15.195312 34.054688 C 19.611697 40.311272 36.484577 25.785901 46.623047 16.070312 A 24 24 0 0 0 45.214844 12.810547 z " + transform="matrix(0.26458333,0,0,0.26458333,0,284.3)" + id="path821" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:3.70416665px;line-height:125%;font-family:Pacifico;-inkscape-font-specification:Pacifico;letter-spacing:0px;word-spacing:0px;fill:#f6b27f;fill-opacity:1;stroke:#f6b27f;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="2.915477" + y="294.59277" + id="text819"><tspan + sodipodi:role="line" + id="tspan817" + x="2.915477" + y="294.59277" + style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.69999981px;font-family:'Ubuntu Mono';-inkscape-font-specification:'Ubuntu Mono Bold';fill:#f6b27f;fill-opacity:1;stroke:#f6b27f;stroke-width:0.26458332px;stroke-opacity:1">C</tspan></text> + </g> +</svg> diff --git a/libs/cargs/docs/build.md b/libs/cargs/docs/build.md new file mode 100644 index 0000000..599c114 --- /dev/null +++ b/libs/cargs/docs/build.md @@ -0,0 +1,49 @@ +--- +title: Building +description: A guide on how to build the cargs command line arguments parser library for C/C++. +--- + +In order to build the source, you will have to download it. You can do so using git (or download it from [here](https://github.com/likle/cargs/archive/stable.zip)). +```bash +git clone -b stable git@github.com:likle/cargs.git +``` + +**Note**: The *stable* branch points to the latest stable version. You should +always use a stable version in production code. + +## Using Windows +Visual Studio 2017 is recommended, then you can just open the source using ``File -> Open -> CMake...``. You can use Visual Studio to compile the source and debug the code. Make sure you have the CMake and C/C++ features enabled. + +## Using Ubuntu +You will need [CMake](https://cmake.org/download/) and either gcc or clang installed. On Ubuntu you can use the following to compile **cargs**: +```bash +sudo apt-get install build-essential cmake +mkdir cargs/build +cd cargs/build +cmake .. +make +``` + +## Using MacOS +You will need [CMake](https://cmake.org/download/) and either gcc or clang installed. On MacOS you can use the following to compile **cargs**: +``` +brew install cmake gcc +mkdir cargs/build +cd cargs/build +cmake .. +make +``` +# Running Tests +After building **cargs** you can run tests to ensure everything is fine. In order to do that, make sure that you are in the build folder and then execute the test program: + +```bash +./cargstest +``` + +That's it! + +You can even specify which tests to execute by optionally specifying the category and test name: +```bash +# ./cargstest [category] [test] +./cargstest option complex +``` diff --git a/libs/cargs/docs/embed.md b/libs/cargs/docs/embed.md new file mode 100644 index 0000000..ed64d4e --- /dev/null +++ b/libs/cargs/docs/embed.md @@ -0,0 +1,47 @@ +--- +title: Embedding +description: A guide on how to embed the cargs command line parser library for C/C++. +--- + + +In order to embed **cargs**, you will have to download it. +You can do so using git (or download it from [here](https://github.com/likle/cargs/archive/stable.zip)). + +```bash +git clone -b stable git@github.com:likle/cargs.git +``` +**Note**: The *stable* branch points to the latest stable version. You should +always use a stable version in production code. + +## Using CMake to embed cargs +If you are using CMake it is fairly easy to embed **cargs**. +This only requires two lines, you don't even have to specify the include directories. +The following example shows how to do so: +```cmake +# Some basics you will need in your cmake file. +cmake_minimum_required(VERSION 3.9.2) +project(example C) +add_executable(example_target main.c) + +# Replace your_path_to_cargs with the path to your cargs copy. +# This could be something like "${CMAKE_CURRENT_SOURCE_DIR}/lib/cargs". +add_subdirectory(your_path_to_cargs) + +# Replace example_target with the target name which requires cargs. +# After this, there is no need to specify any include directories. +target_link_libraries(example_target cargs) +``` + +After that, you should be able to use cargs in your source code: +```c +#include <cargs.h> +``` + +## Directly embed cargs in your source +If you don't use CMake and would like to embed **cargs** directly, you could +just add the two files ``src/cargs.c`` and ``ìnclude/cargs.h`` to your project. +The folder containing ``cargs.h`` has to be in your include directories +([Visual Studio](https://docs.microsoft.com/en-us/cpp/ide/vcpp-directories-property-page?view=vs-2017), +[Eclipse](https://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_prop_general_pns_inc.htm), +[gcc](https://www.rapidtables.com/code/linux/gcc/gcc-i.html), +[clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#include-path-management)). diff --git a/libs/cargs/docs/index.md b/libs/cargs/docs/index.md new file mode 100644 index 0000000..60c598e --- /dev/null +++ b/libs/cargs/docs/index.md @@ -0,0 +1,129 @@ +--- +title: C/C++ Command Line Argument Parser +description: cargs is a lightweight C/C++ command line argument parser library which can be used to parse argv and argc parameters passed to a main function. +--- + +## What is cargs? +**cargs** is a lightweight C/C++ command line argument parser library which can be used to parse argv and argc parameters passed to a main function. + +## Example +Here is a simple example of cargs in action. + ```c +#include <cargs.h> +#include <stdbool.h> +#include <stdlib.h> + +/** + * This is the main configuration of all options available. + */ +static struct cag_option options[] = { + {.identifier = 's', + .access_letters = "s", + .access_name = NULL, + .value_name = NULL, + .description = "Simple flag"}, + + {.identifier = 'm', + .access_letters = "mMoO", + .access_name = NULL, + .value_name = NULL, + .description = "Multiple access letters"}, + + {.identifier = 'l', + .access_letters = NULL, + .access_name = "long", + .value_name = NULL, + .description = "Long parameter name"}, + + {.identifier = 'k', + .access_letters = "k", + .access_name = "key", + .value_name = "VALUE", + .description = "Parameter value"}, + + {.identifier = 'h', + .access_letters = "h", + .access_name = "help", + .description = "Shows the command help"}}; + +/** + * This is a custom project configuration structure where you can store the + * parsed information. + */ +struct demo_configuration +{ + bool simple_flag; + bool multiple_flag; + bool long_flag; + const char *key; +}; + +int main(int argc, char *argv[]) +{ + char identifier; + const char *value; + cag_option_context context; + struct demo_configuration config = {false, false, false, NULL}; + + /** + * Now we just prepare the context and iterate over all options. Simple! + */ + cag_option_prepare(&context, options, CAG_ARRAY_SIZE(options), argc, argv); + while (cag_option_fetch(&context)) { + identifier = cag_option_get(&context); + switch (identifier) { + case 's': + config.simple_flag = true; + break; + case 'm': + config.multiple_flag = true; + break; + case 'l': + config.long_flag = true; + break; + case 'k': + value = cag_option_get_value(&context); + config.key = value; + break; + case 'h': + printf("Usage: cargsdemo [OPTION]...\n"); + printf("Demonstrates the cargs library.\n\n"); + cag_option_print(options, CAG_ARRAY_SIZE(options), stdout); + printf("\nNote that all formatting is done by cargs.\n"); + return EXIT_SUCCESS; + } + } + + printf("simple_flag: %i, multiple_flag: %i, long_flag: %i, key: %s\n", + config.simple_flag, config.multiple_flag, config.long_flag, + config.key ? config.key : "-"); + + return EXIT_SUCCESS; +} + +``` + +### Example output +```console +foo@bar:~$ ./cargsdemo +simple_flag: 0, multiple_flag: 0, long_flag: 0, key: - +``` +<br> +```console +foo@bar:~$ ./cargsdemo -k=test -sm --long +simple_flag: 1, multiple_flag: 1, long_flag: 1, key: test +``` +<br> +```console +foo@bar:~$ ./cargsdemo --help +Usage: cargsdemo [OPTION]... +Demonstrates the cargs library. + + -s Simple flag + -m, -M, -o, -O Multiple access letters + --long Long parameter name + -k, --key=VALUE Parameter value + -h, --help Shows the command help + +Note that all formatting is done by cargs. +``` diff --git a/libs/cargs/docs/reference/cag_option_fetch.md b/libs/cargs/docs/reference/cag_option_fetch.md new file mode 100755 index 0000000..331ac20 --- /dev/null +++ b/libs/cargs/docs/reference/cag_option_fetch.md @@ -0,0 +1,32 @@ +---
+title: cag_option_fetch
+description: Fetches an option from the argument list.
+---
+
+_(since v1.0.0)_
+Fetches an option from the argument list.
+
+## Description
+```c
+bool cag_option_fetch(cag_option_context *context);
+```
+
+This function fetches a single option from the argument list. The context
+will be moved to that item. Information can be extracted from the context
+after the item has been fetched.
+The arguments will be re-ordered, which means that non-option arguments will
+be moved to the end of the argument list. After all options have been
+fetched, all non-option arguments will be positioned after the index of
+the context.
+
+## Parameters
+ * **context**: The context from which we will fetch the option.
+
+## Return Value
+Returns true if there was another option or false if the end is reached.
+
+## Changelog
+
+| Version | Description |
+|------------|--------------------------------------------------------|
+| **v1.0.0** | The function is introduced. |
diff --git a/libs/cargs/docs/reference/cag_option_get.md b/libs/cargs/docs/reference/cag_option_get.md new file mode 100755 index 0000000..8777744 --- /dev/null +++ b/libs/cargs/docs/reference/cag_option_get.md @@ -0,0 +1,26 @@ +---
+title: cag_option_get
+description: Gets the identifier of the option.
+---
+
+_(since v1.0.0)_
+Gets the identifier of the option.
+
+## Description
+```c
+char cag_option_get(const cag_option_context *context);
+```
+This function gets the identifier of the option, which should be unique to
+this option and can be used to determine what kind of option this is.
+
+## Parameters
+ * **context**: The context from which the option was fetched.
+
+## Return Value
+Returns the identifier of the option.
+
+## Changelog
+
+| Version | Description |
+|------------|--------------------------------------------------------|
+| **v1.0.0** | The function is introduced. |
diff --git a/libs/cargs/docs/reference/cag_option_get_index.md b/libs/cargs/docs/reference/cag_option_get_index.md new file mode 100755 index 0000000..ef27d88 --- /dev/null +++ b/libs/cargs/docs/reference/cag_option_get_index.md @@ -0,0 +1,29 @@ +---
+title: cag_option_get_index
+description: Gets the current index of the context.
+---
+
+_(since v1.0.0)_
+Gets the current index of the context.
+
+## Description
+```c
+int cag_option_get_index(const cag_option_context *context);
+```
+
+This function gets the index within the argv arguments of the context. The
+context always points to the next item which it will inspect. This is
+particularly useful to inspect the original argument array, or to get
+non-option arguments after option fetching has finished.
+
+## Parameters
+ * **context**: The context from which the option was fetched.
+
+## Return Value
+Returns the current index of the context.
+
+## Changelog
+
+| Version | Description |
+|------------|--------------------------------------------------------|
+| **v1.0.0** | The function is introduced. |
diff --git a/libs/cargs/docs/reference/cag_option_get_value.md b/libs/cargs/docs/reference/cag_option_get_value.md new file mode 100755 index 0000000..462e2e7 --- /dev/null +++ b/libs/cargs/docs/reference/cag_option_get_value.md @@ -0,0 +1,27 @@ +---
+title: cag_option_get_value
+description: Gets the value from the option.
+---
+
+_(since v1.0.0)_
+Gets the value from the option.
+
+## Description
+```c
+const char *cag_option_get_value(const cag_option_context *context);
+```
+
+This function gets the value from the option, if any. If the option does not
+contain a value, this function will return NULL.
+
+## Parameters
+ * **context**: The context from which the option was fetched.
+
+## Return Value
+Returns a pointer to the value or NULL if there is no value.
+
+## Changelog
+
+| Version | Description |
+|------------|--------------------------------------------------------|
+| **v1.0.0** | The function is introduced. |
diff --git a/libs/cargs/docs/reference/cag_option_prepare.md b/libs/cargs/docs/reference/cag_option_prepare.md new file mode 100644 index 0000000..c9aa9e5 --- /dev/null +++ b/libs/cargs/docs/reference/cag_option_prepare.md @@ -0,0 +1,30 @@ +---
+title: cag_option_prepare
+description: Prepare argument options context for parsing.
+---
+
+_(since v1.0.0)_
+Prepare argument options context for parsing.
+
+## Description
+```c
+void cag_option_prepare(cag_option_context *context, const cag_option *options,
+ size_t option_count, int argc, char **argv);
+```
+
+This function prepares the context for iteration and initializes the context
+with the supplied options and arguments. After the context has been prepared,
+it can be used to fetch arguments from it.
+
+## Parameters
+ * **context**: The context which will be initialized.
+ * **options**: The registered options which are available for the program.
+ * **option_count**: The amount of options which are available for the program.
+ * **argc**: The amount of arguments the user supplied in the main function.
+ * **argv**: A pointer to the arguments of the main function.
+
+## Changelog
+
+| Version | Description |
+|------------|--------------------------------------------------------|
+| **v1.0.0** | The function is introduced. |
diff --git a/libs/cargs/docs/reference/cag_option_print.md b/libs/cargs/docs/reference/cag_option_print.md new file mode 100755 index 0000000..c4531eb --- /dev/null +++ b/libs/cargs/docs/reference/cag_option_print.md @@ -0,0 +1,28 @@ +---
+title: cag_option_print
+description: Prints all options to the terminal.
+---
+
+_(since v1.0.0)_
+description: Prints all options to the terminal.
+
+## Description
+```c
+void cag_option_print(const cag_option *options, size_t option_count,
+ FILE *destination);
+```
+
+This function prints all options to the terminal. This can be used to generate
+the output for a "--help" option.
+
+## Parameters
+ * **options**: The options which will be printed.
+ * **option_count**: The option count which will be printed.
+ * **destination**: The destination where the output will be printed.
+
+
+## Changelog
+
+| Version | Description |
+|------------|--------------------------------------------------------|
+| **v1.0.0** | The function is introduced. |
diff --git a/libs/cargs/docs/reference/index.md b/libs/cargs/docs/reference/index.md new file mode 100644 index 0000000..654d9fe --- /dev/null +++ b/libs/cargs/docs/reference/index.md @@ -0,0 +1,30 @@ +--- +title: Reference +description: A complete reference of the cargs command line arguments parser library for C/C++. +--- + +## Basic +The basic functions available in cargs, which can be used to do basic command line argument parsing. + +### Functions +* **[cag_option_prepare]({{ site.baseurl }}{% link reference/cag_option_prepare.md %})** +Prepare argument options context for parsing. + +* **[cag_option_fetch]({{ site.baseurl }}{% link reference/cag_option_fetch.md %})** +Fetches an option from the argument list. + +* **[cag_option_get]({{ site.baseurl }}{% link reference/cag_option_get.md %})** + Gets the identifier of the option. + +* **[cag_option_get_value]({{ site.baseurl }}{% link reference/cag_option_get_value.md %})** +Gets the value from the option. + +* **[cag_option_get_index]({{ site.baseurl }}{% link reference/cag_option_get_index.md %})** +Gets the current index of the context. + +## Output +This section describes functions which are used to output argument information. + +### Functions +* **[cag_option_print]({{ site.baseurl }}{% link reference/cag_option_print.md %})** +Prints all options to the terminal. |