diff --git a/dev/linol-lwt/Linol_lwt/.dune-keep b/.nojekyll similarity index 100% rename from dev/linol-lwt/Linol_lwt/.dune-keep rename to .nojekyll diff --git a/_config.yml b/_config.yml deleted file mode 100644 index 2f7efbea..00000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-minimal \ No newline at end of file diff --git a/_odoc-theme/fonts/DejaVuSansMono-Bold.woff2 b/_odoc-theme/fonts/DejaVuSansMono-Bold.woff2 new file mode 100644 index 00000000..f2b469a6 Binary files /dev/null and b/_odoc-theme/fonts/DejaVuSansMono-Bold.woff2 differ diff --git a/_odoc-theme/fonts/DejaVuSansMono-BoldOblique.woff2 b/_odoc-theme/fonts/DejaVuSansMono-BoldOblique.woff2 new file mode 100644 index 00000000..c28f9107 Binary files /dev/null and b/_odoc-theme/fonts/DejaVuSansMono-BoldOblique.woff2 differ diff --git a/_odoc-theme/fonts/DejaVuSansMono-Oblique.woff2 b/_odoc-theme/fonts/DejaVuSansMono-Oblique.woff2 new file mode 100644 index 00000000..2631692e Binary files /dev/null and b/_odoc-theme/fonts/DejaVuSansMono-Oblique.woff2 differ diff --git a/_odoc-theme/fonts/DejaVuSansMono.woff2 b/_odoc-theme/fonts/DejaVuSansMono.woff2 new file mode 100644 index 00000000..cf200e12 Binary files /dev/null and b/_odoc-theme/fonts/DejaVuSansMono.woff2 differ diff --git a/_odoc-theme/fonts/PTC55F.woff2 b/_odoc-theme/fonts/PTC55F.woff2 new file mode 100644 index 00000000..aa67b386 Binary files /dev/null and b/_odoc-theme/fonts/PTC55F.woff2 differ diff --git a/_odoc-theme/fonts/PTC75F.woff2 b/_odoc-theme/fonts/PTC75F.woff2 new file mode 100644 index 00000000..fa5a500e Binary files /dev/null and b/_odoc-theme/fonts/PTC75F.woff2 differ diff --git a/_odoc-theme/fonts/PTS55F.woff2 b/_odoc-theme/fonts/PTS55F.woff2 new file mode 100644 index 00000000..0aef8b14 Binary files /dev/null and b/_odoc-theme/fonts/PTS55F.woff2 differ diff --git a/_odoc-theme/fonts/PTS56F.woff2 b/_odoc-theme/fonts/PTS56F.woff2 new file mode 100644 index 00000000..2fd9d9af Binary files /dev/null and b/_odoc-theme/fonts/PTS56F.woff2 differ diff --git a/_odoc-theme/fonts/PTS75F.woff2 b/_odoc-theme/fonts/PTS75F.woff2 new file mode 100644 index 00000000..a0fa7de3 Binary files /dev/null and b/_odoc-theme/fonts/PTS75F.woff2 differ diff --git a/_odoc-theme/fonts/PTS76F.woff2 b/_odoc-theme/fonts/PTS76F.woff2 new file mode 100644 index 00000000..8cae8e79 Binary files /dev/null and b/_odoc-theme/fonts/PTS76F.woff2 differ diff --git a/_odoc-theme/fonts/fonts.css b/_odoc-theme/fonts/fonts.css new file mode 100644 index 00000000..9bffe8e8 --- /dev/null +++ b/_odoc-theme/fonts/fonts.css @@ -0,0 +1,59 @@ +@charset "UTF-8"; + +/* PT Sans */ + +@font-face +{ font-family: 'PT-Sans'; + src: url('PTS55F.woff2') format('woff2'); + font-weight: 400; font-style: normal; } + +@font-face +{ font-family: 'PT-Sans'; + src: url('PTS75F.woff2') format('woff2'); + font-weight: 700; font-style: normal; } + +@font-face +{ font-family: 'PT-Sans'; + src: url('PTS56F.woff2') format('woff2'); + font-weight: 400; font-style: italic; } + +@font-face +{ font-family: 'PT-Sans'; + src: url('PTS76F.woff2') format('woff2'); + font-weight: 700; font-style: italic; } + +/* PT Sans caption */ + +@font-face +{ font-family: 'PT-Sans-Caption'; + src: url('PTC55F.woff2') format('woff2'); + font-weight: 400; font-style: normal; } + +@font-face +{ font-family: 'PT-Sans-Caption'; + src: url('PTC75F.woff2') format('woff2'); + font-weight: 700; font-style: normal; } + +/* DejaVu 400 */ + +@font-face +{ font-family: 'DejaVu-SansMono'; + src: url('DejaVuSansMono.woff2') format('woff2'); + font-weight: 400; font-style: normal; } + +@font-face +{ font-family: 'DejaVu-SansMono'; + src: url('DejaVuSansMono-Oblique.woff2') format('woff2'); + font-weight: 400; font-style: oblique; } + +/* DejaVu 700 */ + +@font-face +{ font-family: 'DejaVu-SansMono'; + src: url('DejaVuSansMono-Bold.woff2') format('woff2'); + font-weight: 700; font-style: normal; } + +@font-face +{ font-family: 'DejaVu-SansMono'; + src: url('DejaVuSansMono-BoldOblique.woff2') format('woff2'); + font-weight: 700; font-style: oblique; } diff --git a/_odoc-theme/manual.css b/_odoc-theme/manual.css new file mode 100644 index 00000000..92a1b438 --- /dev/null +++ b/_odoc-theme/manual.css @@ -0,0 +1,376 @@ +@charset "UTF-8"; +@import url("fonts/fonts.css"); +@import url("theme.css"); + +/* Copyright (c) 2019 The odig programmers. All rights reserved. + Distributed under the ISC license, see terms at the end of the file. + odig v0.0.9 */ + +:root { --font-headings: "PT-Sans-Caption"; + --font-body: "PT-Sans"; + --font-mono: "DejaVu-SansMono"; + + --size-font: 0.96875rem; + --size-font-micro: calc(0.675 * var(--size-font)); + --size-font-tiny-ratio: 0.75; + --size-font-tiny: calc(var(--size-font-tiny-ratio) * var(--size-font)); + --size-font-small: calc(0.875 * var(--size-font)); + --size-font-large: calc(1.25 * var(--size-font)); + --size-font-big: calc(1.5 * var(--size-font)); + --size-font-huge: calc(1.75 * var(--size-font)); + --size-font-mono-ratio: 0.87097; + --size-line-ratio: 1.5; + --size-line: calc(var(--size-line-ratio) * var(--size-font)); + --size-half-line: calc(0.5 * var(--size-line)); } + +/* Reset a few things. */ + +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre, +a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,select, +small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li, +fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td, +article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup, +menu,nav,output,ruby,section,summary,time,mark,audio,video,button,input +{ margin: 0; padding: 0; border: 0; /* outline: 0; */ + font-size: inherit; font: inherit; font-weight: inherit; + line-height: inherit; vertical-align: baseline; + text-align: inherit; color: inherit; background: transparent; } + +table { border-collapse: collapse; border-spacing: 0; } +*, *:before, *:After { box-sizing: border-box; } + +/* Note the stylesheet has quite hackish CSS selectors as the markup's + classification is sometimes a bit lacking. */ + +/* Geometry. + See also media adjustements at the end of the stylesheet. */ + +body { background-color: var(--color-bg); + color: var(--color-fg); + font-size: var(--size-font); + font-family: var(--font-body), sans-serif; + font-weight: 400; + line-height: var(--size-line); + text-align: left; + position: relative; + max-width: 120ch; + margin: 0 auto; + padding: calc(1.5 * var(--size-line)); + padding-top: calc(0.5 * var(--size-line)); } + +body > * { max-width: 80ch; width: 75% } +body > ul:first-of-type:not(.itemize):not(.ftoc2) /* toc */ +{ position: absolute; + top: 0px; right: 0px; + width: 20%; + margin-left: var(--size-line); + margin-top: calc(2 * var(--size-line)); + margin-right: var(--size-line); + border-top: solid thin var(--color-rule); } + +/* Rules + We remove the top one, keep the last one and add one over h1 and h2 */ + +body > hr:last-of-type { + margin-top: var(--size-line); + border-style: none; + width: 100%; + max-width: 100%; + text-align: right; + border-top: solid thin var(--color-rule); } + +body > hr:first-of-type { display: none } /* order with last-of-type imporant */ +h1, h2 { border-top: solid thin var(--color-rule) } + +/* Hacks */ + +body > a > img /* Navigation arrows, a bit problematic for dark themes */ +{ display: inline-block; margin:0; + background-color: var(--color-code-block-bg); /* bof */ } + +body > p br, h1 br { display: none; } /* brs should die */ + +/* Basic markup */ + +h1, h2, h3, h4, h5, h6 +{ font-family: var(--font-headings), sans-serif; + font-weight: 400; + text-transform: uppercase; + margin-top: var(--size-line); } + +h1, h2 { line-height: calc(1.5 * var(--size-line)); + padding-top: calc(0.75 * var(--size-line)); } + +hr + h1, hr + h2 { margin-top: calc(0.25 * var(--size-line)) } + +h1 { font-size: var(--size-font-huge); } +h2 { font-size: var(--size-font-big); } +h3 { font-size: var(--size-font-large); } + +div, nav, p, ol, ul, dl, pre, table, blockquote +{ margin-top: var(--size-half-line); } + +ul, ol { list-style-position: outside } +ul { list-style-type: square } +ul > li { margin-left: 2.25ch; } +ol > li { margin-left: 2ch; } + +em { font-style: italic } +b, strong { font-weight: 700 } +small { font-size: var(--size-font-small); } + +sup { vertical-align: super; } +sub { vertical-align: sub; } +sup, sub { font-size : calc(1em * var(--size-font-tiny-ratio)); + line-height: 0; margin-left: 0.2ex; } + +img { display: block; + margin-top: var(--size-half-line); margin-bottom: var(--size-half-line); } + +blockquote { margin-left: var(--size-half-line); } + +/* Links and anchors. Note anchors need to be refined a bit further down + in certain cases. */ + +a { text-decoration:none; color: var(--color-link); } +a:hover { box-shadow:0 1px 0 0 var(--color-link); } +a.anchor:before { content: "#" } +a.anchor:hover { box-shadow: none; text-decoration: underline; } +*:hover > a.anchor { visibility: visible } +a.anchor +{ visibility: hidden; position: absolute; + font-weight: normal; + font-style: normal; + margin-left: -2.5ch; + padding-right: 1ch; padding-left: 1ch; /* To remain selectable */ + color: var(--color-link); + text-align: right; + } + +*:target /* Linked highlight */ +{ background-color: var(--color-bg-highlight); + box-shadow: 0 0 0 3px var(--color-bg-highlight) } + +/* Code and code highlighting */ + +.c003, .c004, .c005, .c006, .c015, +code, pre +{ font-family: var(--font-mono), monospace; + font-weight: 400; + font-size: calc(1em * var(--size-font-mono-ratio)); + color: var(--color-code-fg); } + +.c004, .c002 { color: var(--color-code-type-id); } +.c005 { font-style: oblique } +.c006 { font-weight: 700 } +.c015 { text-align: left } + +pre .c003, pre .c004, pre .c005, pre .c006, +pre code { font-size: inherit } /* don't apply transform twice... */ +a code { color: inherit } +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { text-transform: none; } + +pre { background: var(--color-code-block-bg); + padding-left: 0.8ch; padding-right: 0.8ch; + margin-left: -0.8ch; margin-right: -0.8ch; + padding-top: 1ch; padding-bottom: 1ch; + white-space: pre-wrap; + word-wrap: break-word; } + +/* Table of contents, like in odoc.css except we don't have a class */ + +body > ul:first-of-type:not(.itemize):not(.ftoc2) +{ font-size: var(--size-font-small); } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) a +{ color : var(--color-fg); } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) a:hover +{ color : var(--color-link); } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) +{ font-family: var(--font-headings); text-transform: uppercase; + list-style-type: none; padding-top: var(--size-line) } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) li +{ margin-left: 0; padding-left: 3.25ch; text-indent: -3.25ch; } + +body > ul:first-of-type:not(.itemize):not(.ftoc2) ul +{ font-family: var(--font-body); + text-transform: none; + margin-top:0; } + +/* toplevel examples */ + +div.caml-example.toplevel div.caml-input::before { content: "#" } +div.caml-input, div.caml-output { margin-top: 0; } + +.caml-input {} +.caml-output { color: var(--color-code-string) /* why not */ } + +/* Other HeVeA classes */ + +.c000 { border-spacing: 2ch; border-collapse: separate; margin: 0 auto; } +.c001 { border-spacing: 1ch; border-collapse: separate } +.c008 { font-size: var(--size-font-small) } +.c009 { font-style:italic } +.c010 { font-style:italic; color:var(--color-link) } +.c011 { font-style:italic; font-weight:700 } +.c012 { font-style:italic } +.c013 { font-style:italic } +.c018 { text-align: right } +.c019 { text-align: left} +.dcenter { margin: 0 auto; } +.description { margin-left: var(--size-line) } +.dd-description br { display: none } +dd + dt { margin-top: var(--size-half-line) } + +dt .c003 { font-style:normal; font-weight:700 } /* options */ + +.indexenv { list-style-type: none } +.indexenv li { margin-left: 0 } + +/* Page specific */ + +/* Cover page */ + +div.maintitle > span > span +{ text-transform: uppercase; + font-family: var(--font-headings); + line-height: var(--size-line-ratio); + font-size: calc(2.25 * var(--size-font)) !important; + margin-left: -0.25ch; /* compensate nbsp */ } + +div.maintitle > span > span > br { display: none } +div.maintitle > span > span > span +{ display: block; + text-transform: none; + font-style: italic; + font-family: var(--font-body); + font-size: var(--size-font-big) !important; } + +div.maintitle > span > span > span > span /* ugh */ +{ font-style: normal; + line-height: var(--size-line); + font-size: var(--size-font) !important; } + +div.maintitle > span > span > span > span > span /* ugh bis */ +{ font-size: var(--size-font-small) !important; + font-style: italic; + margin-left: -1.25ch; } + +div.maintitle + blockquote hr { display : none } +div.maintitle + blockquote +{ margin: 0; +/* margin-top: calc(-1 * var(--size-line)); chrome but not FF, bah... */ + font-size: var(--size-font-small); + border-bottom: solid thin var(--color-rule); + padding-bottom: var(--size-half-line); } + +div.maintitle ~ blockquote:last-of-type { display: none } /* remove branding */ + +div.maintitle ~ ul:first-of-type:not(.itemize):not(.ftoc2) /* undo side toc */ +{ position: static; + padding: 0; + margin: 0; margin-top: var(--size-line); + width: 100%; } + +div.maintitle ~ br { display: none } +div.maintitle ~ ul:first-of-type:not(.itemize):not(.ftoc2) > li { margin: 0; } +div.maintitle ~ ul:first-of-type:not(.itemize):not(.ftoc2) a +{ color: var(--color-link) } + +div.maintitle ~ table { margin-top: 0 } +div.maintitle ~ ul:first-of-type:not(.itemize):not(.ftoc2) +{ list-style-type: none; + font-family: inherit; text-transform: inherit; + font-size: inherit; + margin-top: var(--size-half-line); + border: none; } + +div.maintitle ~ ul { list-style-type: none } +div.maintitle ~ ul li { margin-left: 0 } + +/* Contents page */ + +h1#sec1 + ul:first-of-type /* undo side toc */ +{ position: static; + list-style-type: none; + margin: 0; margin-top: var(--size-half-line); + width: 100%; border: none; padding: 0; + font-size: var(--size-font-big); } + +h1#sec1 + ul:first-of-type li +{ margin-left: 0; padding-left: 0; text-indent: 0 } + +h1#sec1 ~ ul ul +{ list-style-type: none; font-size: var(--size-font-large); font-style: italic;} + +h1#sec1 ~ ul ul ul +{ font-size: var(--size-font); font-style: normal; + margin-top: var(--size-half-line); } + +h1#sec1 ~ ul ul ul ul { margin-left: 2.5ch; margin-top: 0;} +h1#sec1 ~ ul > li { margin-top: var(--size-line); } +h1#sec1 ~ ul > li > ul > li { margin-top: var(--size-half-line); } + +/* Media adjustments */ + +@media only screen and (min-width:160ch) /* and (min-height: 60rem) */ +{ +:root { --size-font: 1.125rem; } /* consider using vmin units */ +} + +@media only screen and (max-width:80ch) +{ + body { padding: var(--size-line); } + body > * { width: 100%; } + body > ul:first-of-type:not(.itemize):not(.ftoc2) + { position: static; + margin: 0; margin-top: var(--size-line); + width: 100%; } + pre { font-size: var(--size-font-tiny); } +} + +@media print +{ + * { -webkit-print-color-adjust: exact; } + .content nav:first-child { visibility: hidden } + body > * { width: 100%; } + body > ul:first-of-type:not(.itemize):not(.ftoc2) + { position: static; width: 100%; + margin: 0; margin-top: var(--size-line); } + + /* odig.light with slight adjustements */ + :root + { --color-bg: white; + --color-bg-highlight: #CAD7EF; + --color-fg: black; + --color-rule: #DADBDB; + + --color-code-block-bg: #E8E8E8; + --color-code-fg: #16191D; + --color-code-comment: #747679; + --color-code-keyword: #874aa9; + --color-code-type-id: #a9874a; + --color-code-string: #4aa987; + + --color-link: #557dcc; + --color-broken-link: #f71414; } +} + +/* +Copyright (c) 2019 The odig programmers + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ diff --git a/_odoc-theme/odoc.css b/_odoc-theme/odoc.css new file mode 100644 index 00000000..1dbc9da2 --- /dev/null +++ b/_odoc-theme/odoc.css @@ -0,0 +1,334 @@ +@charset "UTF-8"; +@import url("fonts/fonts.css"); +@import url("theme.css"); + +/* Copyright (c) 2019 The odig programmers. All rights reserved. + Distributed under the ISC license, see terms at the end of the file. */ + +/* Reset a few things. */ + +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre, +a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,select, +small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li, +fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td, +article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup, +menu,nav,output,ruby,section,summary,time,mark,audio,video,button,input +{ margin: 0; padding: 0; border: 0; /* outline: 0; */ + font-size: inherit; font: inherit; font-weight: inherit; + line-height: inherit; vertical-align: baseline; + text-align: inherit; color: inherit; background: transparent; } + +table { border-collapse: collapse; border-spacing: 0; } +*, *:before, *:after { box-sizing: border-box; } + +/* Basic geometry */ + +:root { --font-headings: "PT-Sans-Caption"; + --font-body: "PT-Sans"; + --font-mono: "DejaVu-SansMono"; + --size-font: 0.96875rem; + --size-font-micro: calc(0.675 * var(--size-font)); + --size-font-tiny-ratio: 0.75; + --size-font-tiny: calc(var(--size-font-tiny-ratio) * var(--size-font)); + --size-font-small: calc(0.875 * var(--size-font)); + --size-font-large: calc(1.25 * var(--size-font)); + --size-font-big: calc(1.5 * var(--size-font)); + --size-font-huge: calc(1.75 * var(--size-font)); + --size-font-mono-ratio: 0.87097; + --size-font-mono-ratio: 0.865; + --size-line-ratio: 1.5; + --size-line: calc(var(--size-line-ratio) * var(--size-font)); + --size-half-line: calc(0.5 * var(--size-line)); + --size-fourth-line: calc(0.25 * var(--size-line)); } + +.odoc { background-color: var(--color-bg); + color: var(--color-fg); + font-size: var(--size-font); + font-family: var(--font-body), sans-serif; + font-weight: 400; + line-height: var(--size-line); + text-align: left; + display: grid; + margin: 0 auto; + max-width: 130ch; + grid-template-columns: minmax(50ch,76ch) minmax(23ch,1fr); + grid-column-gap: calc(2 * var(--size-line)); + grid-template-areas: "nav nav" + "header toc" + "content toc"; + padding: calc(1.5 * var(--size-line)); + padding-top: calc(0.5 * var(--size-line)); } + +.odoc-nav { grid-area: nav; } +.odoc-preamble { grid-area: header; } +.odoc-content { grid-area: content; margin: 0 } +.odoc-toc +{ grid-area: toc; + margin-top: var(--size-line); + border-top: solid thin var(--color-rule); } + +/* Media adjustments */ + +@media only screen and (min-width:160ch) /* and (min-height: 60rem) */ +{ + :root { --size-font: 1.125rem; } /* consider using vmin units */ +} + +@media only screen and (max-width:80ch) /* Basically mobile */ +{ + .odoc + { padding: var(--size-line); + grid-template-columns: auto; + grid-template-rows: none; + grid-template-areas: "nav" + "header" + "toc" + "content"; } + .odoc-toc { margin: 0; margin-top: var(--size-line); } + pre { font-size: var(--size-font-tiny); } +} + +@media print +{ + * { -webkit-print-color-adjust: exact; } + .odoc-nav { visibility: hidden } + .odoc-toc { margin: 0; margin-top: var(--size-line); } + + /* odig.light with slight adjustements */ + :root + { --color-bg: white; + --color-bg-highlight: #CAD7EF; + --color-fg: black; + --color-rule: #DADBDB; + + --color-code-block-bg: #E8E8E8; + --color-code-fg: #16191D; + --color-code-comment: #747679; + --color-code-keyword: #874aa9; + --color-code-type-id: #a9874a; + --color-code-string: #4aa987; + + --color-link: #557dcc; + --color-broken-link: #f71414; } +} + +/* Block level markup */ + +header > * + *, div > * + *, details > * + * +{ margin-top: var(--size-half-line); } + +ul + * , ol + * { margin-top: 0; } +ul, ol { margin-top: var(--size-fourth-line); + margin-bottom: var(--size-fourth-line); + list-style-position: outside; } + +li *:first-child, li ol, li ul { margin-top: 0; } + +ul { list-style-type: square; } +ul > li { margin-left: 2.25ch; } +ol > li { margin-left: 2ch; } +ol li::marker +{ font-family: var(--font-headings), sans-serif; + font-size: var(--size-font-small); } + +img +{ display: block; + margin-top: var(--size-half-line); + margin-bottom: var(--size-half-line); } + +/* Headings and horizontal rulers */ + +h1, h2, .odoc-content > *:first-child +{ border-top: solid thin var(--color-rule); + padding-top: calc(0.75 * var(--size-line)); + margin-top: var(--size-line); } + +h1, h2, h3, h4, h5, h6 +{ font-family: var(--font-headings), sans-serif; + font-weight: 400; + text-transform: uppercase; + margin-top: var(--size-line); } + +h1, h2 { line-height: calc(1.5 * var(--size-line)); } +h1 { font-size: var(--size-font-huge); } +h2 { font-size: var(--size-font-big); } +h3 { font-size: var(--size-font-large); } + +/* Phrasing content */ + +em { font-style: italic } +b, strong { font-weight: 700 } +small { font-size: var(--size-font-small); } + +sup { vertical-align: super; } +sub { vertical-align: sub; } +sup, sub +{ font-size : calc(1em * var(--size-font-tiny-ratio)); + line-height: 0; margin-left: 0.2ex; } + +/* Code and code highlighting */ + +code, pre +{ font-family: var(--font-mono), monospace; + font-weight: 400; + font-size: calc(1em * var(--size-font-mono-ratio)); + color: var(--color-code-fg); + overflow-wrap: anywhere; } + +code span span { white-space: nowrap } /* Do not break these units */ + +pre code { font-size: inherit } /* don't apply transform twice... */ +a code { color: inherit } +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { text-transform: none; } + +pre +{ background: var(--color-code-block-bg); + padding-left: 0.8ch; padding-right: 0.8ch; + margin-left: -0.8ch; margin-right: -0.8ch; + padding-top: 1ch; padding-bottom: 1ch; + white-space: pre-wrap; + overflow-wrap: break-word; } + +.arrow { white-space: nowrap } +.keyword , .hljs-keyword { color : var(--color-code-keyword); } +.hljs-type { color : var(--color-code-type-id); } +.hljs-string { color : var(--color-code-string); } +.hljs-comment { color : var(--color-code-comment); font-style: italic; } + +/* Links and anchors. Note anchors need to be refined a bit further down + in certain cases. */ + +a { text-decoration:none; color: var(--color-link); } +a:hover { box-shadow:0 1px 0 0 var(--color-link); } +a.anchor:before { content: "#" } +a.anchor:hover { box-shadow: none; text-decoration: underline; } +*:hover > a.anchor { visibility: visible } +a.anchor +{ visibility: hidden; position: absolute; + font-weight: normal; + font-style: normal; + margin-left: -2.5ch; + padding-right: 1ch; padding-left: 1ch; /* To remain selectable */ + color: var(--color-link); + text-align: right; } + +*:target /* Linked highlight */ +{ background-color: var(--color-bg-highlight); + box-shadow: 0 0 0 3px var(--color-bg-highlight) } + +.xref-unresolved { box-shadow:0 1px 0 0 var(--color-broken-link)} + +/* Table of contents */ + +.odoc-toc { font-size: var(--size-font-small); } +.odoc-toc a { color : var(--color-fg); } +.odoc-toc a:hover { color : var(--color-link) } +.odoc-toc ul +{ font-family: var(--font-headings); text-transform: uppercase; + margin-top: var(--size-line); + list-style-type: none; } + +.odoc-toc ul ul +{ font-family: var(--font-body); text-transform: none; margin-top:0; } + +.odoc-toc ul ul ul { margin-left:1.5ch } +.odoc-toc li { margin-left: 0; padding-left: 1ch; text-indent: -1ch; } +.odoc-toc > ul > li { margin-top: calc(0.25 * var(--size-half-line)) } +.odoc-toc > ul > li > ul > li:last-child +{ margin-bottom: var(--size-half-line) } + +.odoc-toc ul ul li { margin-left: 0; padding-left: 0; } + +/* Module structure items */ + +.odoc-spec { padding-bottom: var(--size-fourth-line); } +.spec { margin-top: 0; } +.spec-doc { margin-top:0; padding-left: 1ch; } +.spec-doc > *:first-child { margin-top: 0 } + +/* Indent on wrap */ +.spec, .spec td:first-child { padding-left: 4ch; text-indent: -4ch } +.spec td.field { padding-left: 6ch } + +.spec .def-doc .comment-delim + * { margin-top: 0 } +.spec .def-doc .comment-delim /* make them invisible yet copy-pastable */ +{ position: absolute; width: 1px; height: 1px; overflow: hidden; } + +/* But we don't do it for types for now because of variants and + records. This makes :target highlight be off. And poses + other problems (e.g. need to indent back the last ] or }. + A better markup strategy should be found here. */ +.spec.type { padding-left: 0; text-indent: 0 } +.spec.type > a.anchor +{ padding-left: 1ch; padding-right: 1ch; /* values from a.anchor */ } +.spec li > a.anchor, .spec > a.anchor +{ padding-right: 0.5ch; padding-left: 2ch; } + +.spec ol { margin:0; list-style-type: none; } +.spec li { margin-left: 0; padding-left: 4ch; text-indent: -4ch } +.spec li.record.field { margin-left: 2ch } + +.spec .def-doc { display: inline-block } +.spec .def-doc { padding-left: /* 4 + 3 */ 7ch; } +.spec .def-doc p { margin-left: -4ch; text-indent: 0 } + +.odoc-include summary { cursor: pointer } + +/* Package, module and @tag lists + + Allowing indent on wrap with the anchor makes all this quite convoluted. + Is there a better way ? */ + +.packages, .modules, .at-tags { list-style-type: none; margin-left: -2ch; } +.packages li, .modules li, .at-tags li { padding-left: 2ch; text-indent: -2ch; } +.modules li a.anchor, .packages li a.anchor +{ padding-right: 0.5ch; padding-left: 2ch; } + +.synopsis { padding-left: 1ch; } +.version { font-size: var(--size-font-micro); } +.at-tag { text-transform : capitalize } + +/* Package page */ + +h1 .version, h1 nav { font-size: var(--size-font); line-height:0 } +h1 nav +{ display: inline-block; + font-family: var(--font-body); + text-transform: capitalize; } + +.package.info td:first-child { padding-right: 2ch; min-width: 13ch} +.package.info ul { list-style-type: none; display: inline; margin:0; padding:0} +.package.info li { display: inline-block; margin:0; margin-right:1ex; } +#info-authors li, #info-maintainers li { display: block; } + +/* Package index page */ + +.by-name nav a +{ font-family: var(--font-headings); + font-size: var(--size-font-large); + text-transform: uppercase; + margin-right: 1ch; + display: inline-block; } + +.by-tag ol { list-style-type: none; } +.by-tag ol.tags li { margin-left: 1ch; display: inline-block } +.by-tag td:first-child +{ font-family: var(--font-headings); + font-size: var(--size-font-large); + text-transform: uppercase; } + +/* +Copyright (c) 2019 The odig programmers + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ diff --git a/_odoc-theme/theme.css b/_odoc-theme/theme.css new file mode 100644 index 00000000..a7a8e6b8 --- /dev/null +++ b/_odoc-theme/theme.css @@ -0,0 +1,34 @@ +:root +{ --color-bg: #F6F6F6; + --color-bg-highlight: #CAD7EF; + --color-fg: #1F2227; + --color-rule: #DADBDB; + + --color-code-block-bg: #E8E8E8; + --color-code-fg: #16191D; + --color-code-comment: #747679; + --color-code-keyword: #874aa9; + --color-code-type-id: #a9874a; + --color-code-string: #4aa987; + + --color-link: #557dcc; + --color-broken-link: #f71414; } + +@media (prefers-color-scheme: dark) +{ +:root +{ --color-bg: #181B20; + --color-bg-highlight: #303644; + --color-fg: #8C8D90; + --color-rule: #2F3236; + + --color-code-block-bg: #24272A; + --color-code-fg: #A3A4A6; + --color-code-comment: #747679; + --color-code-keyword: #7F668D; + --color-code-type-id: #8D7F66; + --color-code-string: #668d7f; + + --color-link: #7788AA; + --color-broken-link: #900505; } +} diff --git a/cmdliner/Cmdliner/Arg/index.html b/cmdliner/Cmdliner/Arg/index.html new file mode 100644 index 00000000..5c663ecc --- /dev/null +++ b/cmdliner/Cmdliner/Arg/index.html @@ -0,0 +1,31 @@ + +Arg (cmdliner.Cmdliner.Arg)

Module Cmdliner.Arg

Terms for command line arguments.

This module provides functions to define terms that evaluate to the arguments provided on the command line.

Basic constraints, like the argument type or repeatability, are specified by defining a value of type Arg.t. Further constraints can be specified during the conversion to a term.

Argument converters

An argument converter transforms a string argument of the command line to an OCaml value. Predefined converters are provided for many types of the standard library.

type 'a parser = string -> [ `Ok of 'a | `Error of string ]

The type for argument parsers.

Deprecated. Use parser signatures of conv or conv'.

  • deprecated Use Arg.conv or Arg.conv' instead.
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

The type for converted argument printers.

type 'a conv = 'a parser * 'a printer

The type for argument converters.

Warning. Do not use directly, use conv or conv'. This type will become abstract in the next major version of cmdliner.

val conv : + ?docv:string -> + ((string -> ('a, [ `Msg of string ]) result) * 'a printer) -> + 'a conv

conv ~docv (parse, print) is an argument converter parsing values with parse and printing them with print. docv is a documentation meta-variable used in the documentation to stand for the argument value, defaults to "VALUE".

val conv' : + ?docv:string -> + ((string -> ('a, string) result) * 'a printer) -> + 'a conv

conv' is like conv but the Error case has an unlabelled string.

val conv_parser : 'a conv -> string -> ('a, [ `Msg of string ]) result

conv_parser c is the parser of c.

val conv_printer : 'a conv -> 'a printer

conv_printer c is the printer of c.

val conv_docv : 'a conv -> string

conv_docv c is c's documentation meta-variable.

Warning. Currently always returns "VALUE" in the future will return the value given to conv or conv'.

val parser_of_kind_of_string : + kind:string -> + (string -> 'a option) -> + string -> + ('a, [ `Msg of string ]) result

parser_of_kind_of_string ~kind kind_of_string is an argument parser using the kind_of_string function for parsing and kind to report errors (e.g. could be "an integer" for an int parser.).

val some' : ?none:'a -> 'a conv -> 'a option conv

some' ?none c is like the converter c except it returns Some value. It is used for command line arguments that default to None when absent. If provided, none is used with conv's printer to document the value taken on absence; to document a more complex behaviour use the absent argument of info.

val some : ?none:string -> 'a conv -> 'a option conv

some ?none c is like some' but none is described as a string that will be rendered in bold.

Arguments and their information

Argument information defines the man page information of an argument and, for optional arguments, its names. An environment variable can also be specified to read the argument value from if the argument is absent from the command line and the variable is defined.

type 'a t

The type for arguments holding data of type 'a.

type info

The type for information about command line arguments.

val info : + ?deprecated:string -> + ?absent:string -> + ?docs:string -> + ?docv:string -> + ?doc:string -> + ?env:Cmd.Env.info -> + string list -> + info

info docs docv doc env names defines information for an argument.

  • names defines the names under which an optional argument can be referred to. Strings of length 1 ("c") define short option names ("-c"), longer strings ("count") define long option names ("--count"). names must be empty for positional arguments.
  • env defines the name of an environment variable which is looked up for defining the argument if it is absent from the command line. See environment variables for details.
  • doc is the man page information of the argument. The documentation language can be used and the following variables are recognized:

    • "$(docv)" the value of docv (see below).
    • "$(opt)", one of the options of names, preference is given to a long one.
    • "$(env)", the environment var specified by env (if any).

    These functions can help with formatting argument values.

  • docv is for positional and non-flag optional arguments. It is a variable name used in the man page to stand for their value.
  • docs is the title of the man page section in which the argument will be listed. For optional arguments this defaults to Manpage.s_options. For positional arguments this defaults to Manpage.s_arguments. However a positional argument is only listed if it has both a doc and docv specified.
  • deprecated, if specified the argument is deprecated and the string is a message output on standard error when the argument is used.
  • absent, if specified a documentation string that indicates what happens when the argument is absent. The document language can be used like in doc. This overrides the automatic default value rendering that is performed by the combinators.
val (&) : ('a -> 'b) -> 'a -> 'b

f & v is f v, a right associative composition operator for specifying argument terms.

Optional arguments

The information of an optional argument must have at least one name or Invalid_argument is raised.

val flag : info -> bool t

flag i is a bool argument defined by an optional flag that may appear at most once on the command line under one of the names specified by i. The argument holds true if the flag is present on the command line and false otherwise.

val flag_all : info -> bool list t

flag_all is like flag except the flag may appear more than once. The argument holds a list that contains one true value per occurrence of the flag. It holds the empty list if the flag is absent from the command line.

val vflag : 'a -> ('a * info) list -> 'a t

vflag v [v0,i0;…] is an 'a argument defined by an optional flag that may appear at most once on the command line under one of the names specified in the ik values. The argument holds v if the flag is absent from the command line and the value vk if the name under which it appears is in ik.

Note. Environment variable lookup is unsupported for for these arguments.

val vflag_all : 'a list -> ('a * info) list -> 'a list t

vflag_all v l is like vflag except the flag may appear more than once. The argument holds the list v if the flag is absent from the command line. Otherwise it holds a list that contains one corresponding value per occurrence of the flag, in the order found on the command line.

Note. Environment variable lookup is unsupported for for these arguments.

val opt : ?vopt:'a -> 'a conv -> 'a -> info -> 'a t

opt vopt c v i is an 'a argument defined by the value of an optional argument that may appear at most once on the command line under one of the names specified by i. The argument holds v if the option is absent from the command line. Otherwise it has the value of the option as converted by c.

If vopt is provided the value of the optional argument is itself optional, taking the value vopt if unspecified on the command line.

val opt_all : ?vopt:'a -> 'a conv -> 'a list -> info -> 'a list t

opt_all vopt c v i is like opt except the optional argument may appear more than once. The argument holds a list that contains one value per occurrence of the flag in the order found on the command line. It holds the list v if the flag is absent from the command line.

Positional arguments

The information of a positional argument must have no name or Invalid_argument is raised. Positional arguments indexing is zero-based.

Warning. The following combinators allow to specify and extract a given positional argument with more than one term. This should not be done as it will likely confuse end users and documentation generation. These over-specifications may be prevented by raising Invalid_argument in the future. But for now it is the client's duty to make sure this doesn't happen.

val pos : ?rev:bool -> int -> 'a conv -> 'a -> info -> 'a t

pos rev n c v i is an 'a argument defined by the nth positional argument of the command line as converted by c. If the positional argument is absent from the command line the argument is v.

If rev is true (defaults to false), the computed position is max-n where max is the position of the last positional argument present on the command line.

val pos_all : 'a conv -> 'a list -> info -> 'a list t

pos_all c v i is an 'a list argument that holds all the positional arguments of the command line as converted by c or v if there are none.

val pos_left : ?rev:bool -> int -> 'a conv -> 'a list -> info -> 'a list t

pos_left rev n c v i is an 'a list argument that holds all the positional arguments as converted by c found on the left of the nth positional argument or v if there are none.

If rev is true (defaults to false), the computed position is max-n where max is the position of the last positional argument present on the command line.

val pos_right : ?rev:bool -> int -> 'a conv -> 'a list -> info -> 'a list t

pos_right is like pos_left except it holds all the positional arguments found on the right of the specified positional argument.

Arguments as terms

val value : 'a t -> 'a Term.t

value a is a term that evaluates to a's value.

val required : 'a option t -> 'a Term.t

required a is a term that fails if a's value is None and evaluates to the value of Some otherwise. Use this for required positional arguments (it can also be used for defining required optional arguments, but from a user interface perspective this shouldn't be done, it is a contradiction in terms).

val non_empty : 'a list t -> 'a list Term.t

non_empty a is term that fails if a's list is empty and evaluates to a's list otherwise. Use this for non empty lists of positional arguments.

val last : 'a list t -> 'a Term.t

last a is a term that fails if a's list is empty and evaluates to the value of the last element of the list otherwise. Use this for lists of flags or options where the last occurrence takes precedence over the others.

Predefined arguments

val man_format : Manpage.format Term.t

man_format is a term that defines a --man-format option and evaluates to a value that can be used with Manpage.print.

Predefined converters

val bool : bool conv

bool converts values with bool_of_string.

val char : char conv

char converts values by ensuring the argument has a single char.

val int : int conv

int converts values with int_of_string.

val nativeint : nativeint conv

nativeint converts values with Nativeint.of_string.

val int32 : int32 conv

int32 converts values with Int32.of_string.

val int64 : int64 conv

int64 converts values with Int64.of_string.

val float : float conv

float converts values with float_of_string.

val string : string conv

string converts values with the identity function.

val enum : (string * 'a) list -> 'a conv

enum l p converts values such that unambiguous prefixes of string names in l map to the corresponding value of type 'a.

Warning. The type 'a must be comparable with Stdlib.compare.

  • raises Invalid_argument

    if l is empty.

val file : string conv

file converts a value with the identity function and checks with Sys.file_exists that a file with that name exists.

val dir : string conv

dir converts a value with the identity function and checks with Sys.file_exists and Sys.is_directory that a directory with that name exists.

val non_dir_file : string conv

non_dir_file converts a value with the identity function and checks with Sys.file_exists and Sys.is_directory that a non directory file with that name exists.

val list : ?sep:char -> 'a conv -> 'a list conv

list sep c splits the argument at each sep (defaults to ',') character and converts each substrings with c.

val array : ?sep:char -> 'a conv -> 'a array conv

array sep c splits the argument at each sep (defaults to ',') character and converts each substring with c.

val pair : ?sep:char -> 'a conv -> 'b conv -> ('a * 'b) conv

pair sep c0 c1 splits the argument at the first sep character (defaults to ',') and respectively converts the substrings with c0 and c1.

val t2 : ?sep:char -> 'a conv -> 'b conv -> ('a * 'b) conv

t2 is pair.

val t3 : ?sep:char -> 'a conv -> 'b conv -> 'c conv -> ('a * 'b * 'c) conv

t3 sep c0 c1 c2 splits the argument at the first two sep characters (defaults to ',') and respectively converts the substrings with c0, c1 and c2.

val t4 : + ?sep:char -> + 'a conv -> + 'b conv -> + 'c conv -> + 'd conv -> + ('a * 'b * 'c * 'd) conv

t4 sep c0 c1 c2 c3 splits the argument at the first three sep characters (defaults to ',') respectively converts the substrings with c0, c1, c2 and c3.

Documentation formatting helpers

val doc_quote : string -> string

doc_quote s quotes the string s.

val doc_alts : ?quoted:bool -> string list -> string

doc_alts alts documents the alternative tokens alts according the number of alternatives. If quoted is:

  • None, the tokens are enclosed in manpage markup directives to render them in bold (manpage convention).
  • Some true, the tokens are quoted with doc_quote.
  • Some false, the tokens are written as is

The resulting string can be used in sentences of the form "$(docv) must be %s".

  • raises Invalid_argument

    if alts is the empty list.

val doc_alts_enum : ?quoted:bool -> (string * 'a) list -> string

doc_alts_enum quoted alts is doc_alts quoted (List.map fst alts).

Deprecated

type 'a converter = 'a conv

See Arg.conv'.

  • deprecated Use Arg.conv' function instead.
val pconv : ?docv:string -> ('a parser * 'a printer) -> 'a conv

pconv is like conv or conv', but uses a deprecated parser signature.

  • deprecated Use Arg.conv or Arg.conv' function instead.
type env = Cmd.Env.info

See Cmd.Env.info

  • deprecated Use Cmd.Env.info instead.
val env_var : + ?deprecated:string -> + ?docs:string -> + ?doc:string -> + Cmd.Env.var -> + Cmd.Env.info

See Cmd.Env.info.

  • deprecated Use Cmd.Env.info instead.
diff --git a/cmdliner/Cmdliner/Cmd/Env/index.html b/cmdliner/Cmdliner/Cmd/Env/index.html new file mode 100644 index 00000000..780c9935 --- /dev/null +++ b/cmdliner/Cmdliner/Cmd/Env/index.html @@ -0,0 +1,2 @@ + +Env (cmdliner.Cmdliner.Cmd.Env)

Module Cmd.Env

Environment variable and their information.

Environment variables

type var = string

The type for environment names.

Environment variable information

type info = Term.env_info

The type for environment variable information.

val info : ?deprecated:string -> ?docs:string -> ?doc:string -> var -> info

info ~docs ~doc var describes an environment variable var such that:

  • doc is the man page information of the environment variable, defaults to "undocumented".
  • docs is the title of the man page section in which the environment variable will be listed, it defaults to Cmdliner.Manpage.s_environment.
  • deprecated, if specified the environment is deprecated and the string is a message output on standard error when the environment variable gets used to lookup the default value of an argument.

In doc the documentation markup language can be used with following variables:

  • $(env), the value of var.
  • The variables mentioned in info.
diff --git a/cmdliner/Cmdliner/Cmd/Exit/index.html b/cmdliner/Cmdliner/Cmd/Exit/index.html new file mode 100644 index 00000000..fc480345 --- /dev/null +++ b/cmdliner/Cmdliner/Cmd/Exit/index.html @@ -0,0 +1,2 @@ + +Exit (cmdliner.Cmdliner.Cmd.Exit)

Module Cmd.Exit

Exit codes and their information.

Exit codes

type code = int

The type for exit codes.

Warning. You should avoid status codes strictly greater than 125 as those may be used by some shells.

val ok : code

ok is 0, the exit status for success.

val some_error : code

some_error is 123, an exit status for indisciminate errors reported on stderr.

val cli_error : code

cli_error is 124, an exit status for command line parsing errors.

val internal_error : code

internal_error is 125, an exit status for unexpected internal errors.

Exit code information

type info

The type for exit code information.

val info : ?docs:string -> ?doc:string -> ?max:code -> code -> info

exit_info ~docs ~doc min ~max describe the range of exit statuses from min to max (defaults to min). doc is the man page information for the statuses, defaults to "undocumented". docs is the title of the man page section in which the statuses will be listed, it defaults to Manpage.s_exit_status.

In doc the documentation markup language can be used with following variables:

  • $(status), the value of min.
  • $(status_max), the value of max.
  • The variables mentioned in the Cmd.info
val info_code : info -> code

info_code i is the minimal code of i.

val defaults : info list

defaults are exit code information for ok, some_error cli_error and internal_error.

diff --git a/cmdliner/Cmdliner/Cmd/index.html b/cmdliner/Cmdliner/Cmd/index.html new file mode 100644 index 00000000..a7552eed --- /dev/null +++ b/cmdliner/Cmdliner/Cmd/index.html @@ -0,0 +1,57 @@ + +Cmd (cmdliner.Cmdliner.Cmd)

Module Cmdliner.Cmd

Commands.

Command line syntaxes are implicitely defined by Terms. A command value binds a syntax and its documentation to a command name.

A command can group a list of sub commands (and recursively). In this case your tool defines a tree of commands, each with its own command line syntax. The root of that tree is called the main command; it represents your tool and its name.

Command information

Command information defines the name and documentation of a command.

module Exit : sig ... end

Exit codes and their information.

module Env : sig ... end

Environment variable and their information.

type info

The type for information about commands.

val info : + ?deprecated:string -> + ?man_xrefs:Manpage.xref list -> + ?man:Manpage.block list -> + ?envs:Env.info list -> + ?exits:Exit.info list -> + ?sdocs:string -> + ?docs:string -> + ?doc:string -> + ?version:string -> + string -> + info

info ?sdocs ?man ?docs ?doc ?version name is a term information such that:

  • name is the name of the command.
  • version is the version string of the command line tool, this is only relevant for the main command and ignored otherwise.
  • deprecated, if specified the command is deprecated and the string is a message output on standard error when the command is used.
  • doc is a one line description of the command used for the NAME section of the command's man page and in command group listings.
  • docs, for commands that are part of a group, the title of the section of the parent's command man page where it should be listed (defaults to Manpage.s_commands).
  • sdocs defines the title of the section in which the standard --help and --version arguments are listed (defaults to Manpage.s_common_options).
  • exits is a list of exit statuses that the command evaluation may produce, defaults to Exit.defaults.
  • envs is a list of environment variables that influence the command's evaluation.
  • man is the text of the man page for the command.
  • man_xrefs are cross-references to other manual pages. These are used to generate a Manpage.s_see_also section.

doc, man, envs support the documentation markup language in which the following variables are recognized:

  • $(tname) the (term's) command's name.
  • $(mname) the main command name.
  • $(iname) the command invocation from main command to the command name.

Commands

type 'a t

The type for commands whose evaluation result in a value of type 'a.

val v : info -> 'a Term.t -> 'a t

v i t is a command with information i and command line syntax parsed by t.

val group : ?default:'a Term.t -> info -> 'a t list -> 'a t

group i ?default cmds is a command with information i that groups sub commands cmds. default is the command line syntax to parse if no sub command is specified on the command line. If default is None (default), the tool errors when no sub command is specified.

val name : 'a t -> string

name c is the name of c.

Evaluation

These functions are meant to be composed with Stdlib.exit. The following exit codes may be returned by all these functions:

These exit codes are described in Exit.defaults which is the default value of the ?exits argument of function info.

val eval : + ?help:Stdlib.Format.formatter -> + ?err:Stdlib.Format.formatter -> + ?catch:bool -> + ?env:(string -> string option) -> + ?argv:string array -> + ?term_err:Exit.code -> + unit t -> + Exit.code

eval cmd is Exit.ok if cmd evaluates to (). See eval_value for other arguments.

val eval' : + ?help:Stdlib.Format.formatter -> + ?err:Stdlib.Format.formatter -> + ?catch:bool -> + ?env:(string -> string option) -> + ?argv:string array -> + ?term_err:Exit.code -> + Exit.code t -> + Exit.code

eval' cmd is c if cmd evaluates to the exit code c. See eval_value for other arguments.

val eval_result : + ?help:Stdlib.Format.formatter -> + ?err:Stdlib.Format.formatter -> + ?catch:bool -> + ?env:(string -> string option) -> + ?argv:string array -> + ?term_err:Exit.code -> + (unit, string) result t -> + Exit.code

eval_result cmd is:

  • Exit.ok if cmd evaluates to Ok ().
  • Exit.some_error if cmd evaluates to Error msg. In this case msg is printed on err.

See eval_value for other arguments.

val eval_result' : + ?help:Stdlib.Format.formatter -> + ?err:Stdlib.Format.formatter -> + ?catch:bool -> + ?env:(string -> string option) -> + ?argv:string array -> + ?term_err:Exit.code -> + (Exit.code, string) result t -> + Exit.code

eval_result' cmd is:

  • c if cmd evaluates to Ok c.
  • Exit.some_error if cmd evaluates to Error msg. In this case msg is printed on err.

See eval_value for other arguments.

Low level evaluation

This interface gives more information on command evaluation results and lets you choose how to map evaluation results to exit codes.

type 'a eval_ok = [
  1. | `Ok of 'a
    (*

    The term of the command evaluated to this value.

    *)
  2. | `Version
    (*

    The version of the main cmd was requested.

    *)
  3. | `Help
    (*

    Help was requested.

    *)
]

The type for successful evaluation results.

type eval_error = [
  1. | `Parse
    (*

    A parse error occurred.

    *)
  2. | `Term
    (*

    A term evaluation error occurred.

    *)
  3. | `Exn
    (*

    An uncaught exception occurred.

    *)
]

The type for erroring evaluation results.

val eval_value : + ?help:Stdlib.Format.formatter -> + ?err:Stdlib.Format.formatter -> + ?catch:bool -> + ?env:(string -> string option) -> + ?argv:string array -> + 'a t -> + ('a eval_ok, eval_error) result

eval ~help ~err ~catch ~env ~argv cmd is the evaluation result of cmd with:

  • argv the command line arguments to parse (defaults to Sys.argv)
  • env the function used for environment variable lookup (defaults to Sys.getenv).
  • catch if true (default) uncaught exceptions are intercepted and their stack trace is written to the err formatter
  • help is the formatter used to print help or version messages (defaults to Format.std_formatter)
  • err is the formatter used to print error messages (defaults to Format.err_formatter).
val eval_peek_opts : + ?version_opt:bool -> + ?env:(string -> string option) -> + ?argv:string array -> + 'a Term.t -> + 'a option * ('a eval_ok, eval_error) result

eval_peek_opts version_opt argv t evaluates t, a term made of optional arguments only, with the command line argv (defaults to Sys.argv). In this evaluation, unknown optional arguments and positional arguments are ignored.

The evaluation returns a pair. The first component is the result of parsing the command line argv stripped from any help and version option if version_opt is true (defaults to false). It results in:

  • Some _ if the command line would be parsed correctly given the partial knowledge in t.
  • None if a parse error would occur on the options of t

The second component is the result of parsing the command line argv without stripping the help and version options. It indicates what the evaluation would result in on argv given the partial knowledge in t (for example it would return `Help if there's a help option in argv). However in contrasts to eval_value no side effects like error reporting or help output occurs.

Note. Positional arguments can't be peeked without the full specification of the command line: we can't tell apart a positional argument from the value of an unknown optional argument.

diff --git a/cmdliner/Cmdliner/Manpage/index.html b/cmdliner/Cmdliner/Manpage/index.html new file mode 100644 index 00000000..2fd1700d --- /dev/null +++ b/cmdliner/Cmdliner/Manpage/index.html @@ -0,0 +1,8 @@ + +Manpage (cmdliner.Cmdliner.Manpage)

Module Cmdliner.Manpage

Man page specification.

Man page generation is automatically handled by Cmdliner, consult the details.

The Manpage.block type is used to define a man page's content. It's a good idea to follow the standard manual page structure.

References.

Man pages

type block = [
  1. | `S of string
  2. | `P of string
  3. | `Pre of string
  4. | `I of string * string
  5. | `Noblank
  6. | `Blocks of block list
]

The type for a block of man page text.

  • `S s introduces a new section s, see the standard section names.
  • `P t is a new paragraph with text t.
  • `Pre t is a new preformatted paragraph with text t.
  • `I (l,t) is an indented paragraph with label l and text t.
  • `Noblank suppresses the blank line introduced between two blocks.
  • `Blocks bs splices the blocks bs.

Except in `Pre, whitespace and newlines are not significant and are all collapsed to a single space. All block strings support the documentation markup language.

val escape : string -> string

escape s escapes s so that it doesn't get interpreted by the documentation markup language.

type title = string * int * string * string * string

The type for man page titles. Describes the man page title, section, center_footer, left_footer, center_header.

type t = title * block list

The type for a man page. A title and the page text as a list of blocks.

type xref = [
  1. | `Main
  2. | `Cmd of string
  3. | `Tool of string
  4. | `Page of string * int
]

The type for man page cross-references.

  • `Main refers to the man page of the program itself.
  • `Cmd cmd refers to the man page of the program's cmd command (which must exist).
  • `Tool bin refers to the command line tool named bin.
  • `Page (name, sec) refers to the man page name(sec).

Standard section names and content

The following are standard man page section names, roughly ordered in the order they conventionally appear. See also man man-pages for more elaborations about what sections should contain.

val s_name : string

The NAME section. This section is automatically created by Cmdliner for your.

val s_synopsis : string

The SYNOPSIS section. By default this section is automatically created by Cmdliner for you, unless it is the first section of your term's man page, in which case it will replace it with yours.

val s_description : string

The DESCRIPTION section. This should be a description of what the tool does and provide a little bit of usage and documentation guidance.

val s_commands : string

The COMMANDS section. By default subcommands get listed here.

val s_arguments : string

The ARGUMENTS section. By default positional arguments get listed here.

val s_options : string

The OPTIONS section. By default optional arguments get listed here.

val s_common_options : string

The COMMON OPTIONS section. By default help and version options get listed here. For programs with multiple commands, optional arguments common to all commands can be added here.

val s_exit_status : string

The EXIT STATUS section. By default term status exit codes get listed here.

val s_environment : string

The ENVIRONMENT section. By default environment variables get listed here.

val s_environment_intro : block

s_environment_intro is the introduction content used by cmdliner when it creates the s_environment section.

val s_files : string

The FILES section.

val s_bugs : string

The BUGS section.

val s_examples : string

The EXAMPLES section.

val s_authors : string

The AUTHORS section.

val s_see_also : string

The SEE ALSO section.

val s_none : string

s_none is a special section named "cmdliner-none" that can be used whenever you do not want something to be listed.

Output

The print function can be useful if the client wants to define other man pages (e.g. to implement a help command).

type format = [
  1. | `Auto
  2. | `Pager
  3. | `Plain
  4. | `Groff
]

The type for man page output specification.

  • `Auto, formats like `Pager or `Plain whenever the TERM environment variable is dumb or unset.
  • `Pager, tries to write to a discovered pager, if that fails uses the `Plain format.
  • `Plain, formats to plain text.
  • `Groff, formats to groff commands.
val print : + ?errs:Stdlib.Format.formatter -> + ?subst:(string -> string option) -> + format -> + Stdlib.Format.formatter -> + t -> + unit

print ~errs ~subst fmt ppf page prints page on ppf in the format fmt. subst can be used to perform variable substitution,(defaults to the identity). errs is used to print formatting errors, it defaults to Format.err_formatter.

diff --git a/cmdliner/Cmdliner/Term/index.html b/cmdliner/Cmdliner/Term/index.html new file mode 100644 index 00000000..8f897f6f --- /dev/null +++ b/cmdliner/Cmdliner/Term/index.html @@ -0,0 +1,32 @@ + +Term (cmdliner.Cmdliner.Term)

Module Cmdliner.Term

Terms.

A term is evaluated by a program to produce a result, which can be turned into an exit status. A term made of terms referring to command line arguments implicitly defines a command line syntax.

Terms

type +'a t

The type for terms evaluating to values of type 'a.

val const : 'a -> 'a t

const v is a term that evaluates to v.

val ($) : ('a -> 'b) t -> 'a t -> 'b t

f $ v is a term that evaluates to the result of applying the evaluation of v to the one of f.

val app : ('a -> 'b) t -> 'a t -> 'b t

app is ($).

Interacting with Cmdliner's evaluation

val term_result : ?usage:bool -> ('a, [ `Msg of string ]) result t -> 'a t

term_result ~usage t evaluates to

  • `Ok v if t evaluates to Ok v
  • `Error `Term with the error message e and usage shown according to usage (defaults to false), if t evaluates to Error (`Msg e).

See also term_result'.

val term_result' : ?usage:bool -> ('a, string) result t -> 'a t

term_result' is like term_result but with a string error case.

val cli_parse_result : ('a, [ `Msg of string ]) result t -> 'a t

cli_parse_result t is a term that evaluates to:

  • `Ok v if t evaluates to Ok v.
  • `Error `Parse with the error message e if t evaluates to Error (`Msg e).

See also cli_parse_result'.

val cli_parse_result' : ('a, string) result t -> 'a t

cli_parse_result' is like cli_parse_result but with a string error case.

val main_name : string t

main_name is a term that evaluates to the main command name; that is the name of the tool.

val choice_names : string list t

choice_names is a term that evaluates to the names of the commands that are children of the main command.

val with_used_args : 'a t -> ('a * string list) t

with_used_args t is a term that evaluates to t tupled with the arguments from the command line that where used to evaluate t.

type 'a ret = [
  1. | `Help of Manpage.format * string option
  2. | `Error of bool * string
  3. | `Ok of 'a
]

The type for command return values. See ret.

val ret : 'a ret t -> 'a t

ret v is a term whose evaluation depends on the case to which v evaluates. With :

  • `Ok v, it evaluates to v.
  • `Error (usage, e), the evaluation fails and Cmdliner prints the error e and the term's usage if usage is true.
  • `Help (format, name), the evaluation fails and Cmdliner prints a manpage in format format. If name is None this is the the main command's manpage. If name is Some c this is the man page of the sub command c of the main command.

Note. While not deprecated you are encouraged not use this API.

Deprecated Term evaluation interface

This interface is deprecated in favor of Cmdliner.Cmd. Follow the compiler deprecation warning hints to transition.

Term information

Term information defines the name and man page of a term. For simple evaluation this is the name of the program and its man page. For multiple term evaluation, this is the name of a command and its man page.

type exit_info

The type for exit status information.

  • deprecated Use Cmd.Exit.info instead.
val exit_info : ?docs:string -> ?doc:string -> ?max:int -> int -> exit_info

exit_info ~docs ~doc min ~max describe the range of exit statuses from min to max (defaults to min). doc is the man page information for the statuses, defaults to "undocumented". docs is the title of the man page section in which the statuses will be listed, it defaults to Manpage.s_exit_status.

In doc the documentation markup language can be used with following variables:

  • $(status), the value of min.
  • $(status_max), the value of max.
  • The variables mentioned in info
  • deprecated Use Cmd.Exit.info instead.
val default_exits : exit_info list

default_exits is information for exit status exit_status_success added to default_error_exits.

  • deprecated Use Cmd.Exit.defaults or Cmd.info's defaults ~exits value instead.
val default_error_exits : exit_info list

default_error_exits is information for exit statuses exit_status_cli_error and exit_status_internal_error.

  • deprecated List.filter the Cmd.Exit.defaults value instead.
type env_info

The type for environment variable information.

  • deprecated Use Cmd.Env.info instead.
val env_info : ?docs:string -> ?doc:string -> string -> env_info

env_info ~docs ~doc var describes an environment variable var. doc is the man page information of the environment variable, defaults to "undocumented". docs is the title of the man page section in which the environment variable will be listed, it defaults to Cmdliner.Manpage.s_environment.

In doc the documentation markup language can be used with following variables:

  • $(env), the value of var.
  • The variables mentioned in info
  • deprecated Use Cmd.Env.info instead.
type info

The type for term information.

  • deprecated Use Cmd.info instead.
val info : + ?man_xrefs:Manpage.xref list -> + ?man:Manpage.block list -> + ?envs:env_info list -> + ?exits:exit_info list -> + ?sdocs:string -> + ?docs:string -> + ?doc:string -> + ?version:string -> + string -> + info

info sdocs man docs doc version name is a term information such that:

  • name is the name of the program or the command.
  • version is the version string of the program, ignored for commands.
  • doc is a one line description of the program or command used for the NAME section of the term's man page. For commands this description is also used in the list of commands of the main term's man page.
  • docs, only for commands, the title of the section of the main term's man page where it should be listed (defaults to Manpage.s_commands).
  • sdocs defines the title of the section in which the standard --help and --version arguments are listed (defaults to Manpage.s_options).
  • exits is a list of exit statuses that the term evaluation may produce.
  • envs is a list of environment variables that influence the term's evaluation.
  • man is the text of the man page for the term.
  • man_xrefs are cross-references to other manual pages. These are used to generate a Manpage.s_see_also section.

doc, man, envs support the documentation markup language in which the following variables are recognized:

  • $(tname) the term's name.
  • $(mname) the main term's name.
  • deprecated Use Cmd.info instead.
val name : info -> string

name ti is the name of the term information.

  • deprecated Use Cmd.name instead.

Evaluation

type 'a result = [
  1. | `Ok of 'a
  2. | `Error of [ `Parse | `Term | `Exn ]
  3. | `Version
  4. | `Help
]

The type for evaluation results.

  • `Ok v, the term evaluated successfully and v is the result.
  • `Version, the version string of the main term was printed on the help formatter.
  • `Help, man page about the term was printed on the help formatter.
  • `Error `Parse, a command line parse error occurred and was reported on the error formatter.
  • `Error `Term, a term evaluation error occurred and was reported on the error formatter (see Term.ret').
  • `Error `Exn, an exception e was caught and reported on the error formatter (see the ~catch parameter of eval).
val eval : + ?help:Stdlib.Format.formatter -> + ?err:Stdlib.Format.formatter -> + ?catch:bool -> + ?env:(string -> string option) -> + ?argv:string array -> + ('a t * info) -> + 'a result

eval help err catch argv (t,i) is the evaluation result of t with command line arguments argv (defaults to Sys.argv).

If catch is true (default) uncaught exceptions are intercepted and their stack trace is written to the err formatter.

help is the formatter used to print help or version messages (defaults to Format.std_formatter). err is the formatter used to print error messages (defaults to Format.err_formatter).

env is used for environment variable lookup, the default uses Sys.getenv.

  • deprecated Use Cmd.v and one of Cmd.eval* instead.
val eval_choice : + ?help:Stdlib.Format.formatter -> + ?err:Stdlib.Format.formatter -> + ?catch:bool -> + ?env:(string -> string option) -> + ?argv:string array -> + ('a t * info) -> + ('a t * info) list -> + 'a result

eval_choice help err catch argv (t,i) choices is like eval except that if the first argument on the command line is not an option name it will look in choices for a term whose information has this name and evaluate it.

If the command name is unknown an error is reported. If the name is unspecified the "main" term t is evaluated. i defines the name and man page of the program.

  • deprecated Use Cmd.group and one of Cmd.eval* instead.
val eval_peek_opts : + ?version_opt:bool -> + ?env:(string -> string option) -> + ?argv:string array -> + 'a t -> + 'a option * 'a result

eval_peek_opts version_opt argv t evaluates t, a term made of optional arguments only, with the command line argv (defaults to Sys.argv). In this evaluation, unknown optional arguments and positional arguments are ignored.

The evaluation returns a pair. The first component is the result of parsing the command line argv stripped from any help and version option if version_opt is true (defaults to false). It results in:

  • Some _ if the command line would be parsed correctly given the partial knowledge in t.
  • None if a parse error would occur on the options of t

The second component is the result of parsing the command line argv without stripping the help and version options. It indicates what the evaluation would result in on argv given the partial knowledge in t (for example it would return `Help if there's a help option in argv). However in contrasts to eval and eval_choice no side effects like error reporting or help output occurs.

Note. Positional arguments can't be peeked without the full specification of the command line: we can't tell apart a positional argument from the value of an unknown optional argument.

  • deprecated Use Cmd.eval_peek_opts instead.

Turning evaluation results into exit codes

Note. If you are using the following functions to handle the evaluation result of a term you should add default_exits to the term's information ~exits argument.

WARNING. You should avoid status codes strictly greater than 125 as those may be used by some shells.

val exit_status_success : int

exit_status_success is 0, the exit status for success.

  • deprecated Use Cmd.Exit.ok instead.
val exit_status_cli_error : int

exit_status_cli_error is 124, an exit status for command line parsing errors.

  • deprecated Use Cmd.Exit.cli_error instead.
val exit_status_internal_error : int

exit_status_internal_error is 125, an exit status for unexpected internal errors.

  • deprecated Use Cmd.Exit.internal_error instead.
val exit_status_of_result : ?term_err:int -> unit result -> int

exit_status_of_result ~term_err r is an exit(3) status code determined from r as follows:

  • deprecated Use Cmd.eval instead.
val exit_status_of_status_result : ?term_err:int -> int result -> int

exit_status_of_status_result is like exit_status_of_result except for `Ok n where n is used as the status exit code.

  • deprecated Use Cmd.eval' instead.
val exit : ?term_err:int -> unit result -> unit

exit ~term_err r is Stdlib.exit @@ exit_status_of_result ~term_err r

  • deprecated Use Stdlib.exit and Cmd.eval instead.
val exit_status : ?term_err:int -> int result -> unit

exit_status ~term_err r is Stdlib.exit @@ exit_status_of_status_result ~term_err r

  • deprecated Use Stdlib.exit and Cmd.eval' instead.
diff --git a/cmdliner/Cmdliner/index.html b/cmdliner/Cmdliner/index.html new file mode 100644 index 00000000..2924fdc9 --- /dev/null +++ b/cmdliner/Cmdliner/index.html @@ -0,0 +1,2 @@ + +Cmdliner (cmdliner.Cmdliner)

Module Cmdliner

Declarative definition of command line interfaces.

Consult the tutorial, details about the supported command line syntax and examples of use.

Open the module to use it, it defines only three modules in your scope.

module Manpage : sig ... end

Man page specification.

module Term : sig ... end

Terms.

module Cmd : sig ... end

Commands.

module Arg : sig ... end

Terms for command line arguments.

diff --git a/cmdliner/_doc-dir/CHANGES.md b/cmdliner/_doc-dir/CHANGES.md new file mode 100755 index 00000000..67d7f8e7 --- /dev/null +++ b/cmdliner/_doc-dir/CHANGES.md @@ -0,0 +1,421 @@ +v1.2.0 2023-04-10 La Forclaz (VS) +--------------------------------- + +- In manpage specification the new variable `$(iname)` substitutes the + command invocation (from program name to subcommand) in bold (#168). + This variable is now used in the default introduction of the `EXIT STATUS` + section. Thanks to Ali Caglayan for suggesting. +- Fix manpage rendering when `PAGER=less` is set (#167). +- Plain text manpage rendering: fix broken handling of `` `Noblank ``. + Thanks to Michael Richards and Reynir Björnsson for the report (#176). +- Fix install to directory with spaces (#172). Thanks to + @ZSFactory for reporting and suggesting the fix. +- Fix manpage paging on Windows (#166). Thanks to Nicolás Ojeda Bär + for the report and the solution. + +v1.1.1 2022-03-23 La Forclaz (VS) +--------------------------------- + +- General documentation fixes, tweaks and improvements. +- Docgen: suppress trailing whitespace in synopsis rendering. +- Docgen: fix duplicate rendering of standard options when using `Term.ret` (#135). +- Docgen: fix duplicate rendering of command name on ``Term.ret (`Help (fmt, None)`` + (#135). + +v1.1.0 2022-02-06 La Forclaz (VS) +--------------------------------- + +- Require OCaml 4.08. + +- Support for deprecating commands, arguments and environment variables (#66). + See the `?deprecated` argument of `Cmd.info`, `Cmd.Env.info` and `Arg.info`. + +- Add `Manpage.s_none` a special section name to use whenever you + want something not to be listed in a command's manpage. + +- Add `Arg.conv'` like `Arg.conv` but with a parser signature that returns + untagged string errors. + +- Add `Term.{term,cli_parse}_result'` functions. + +- Add deprecation alerts on what is already deprecated. + +- On unices, use `command -v` rather than `type` to find commands. + +- Stop using backticks for left quotes. Use apostrophes everywhere. + Thanks to Ryan Moore for reporting a typo that prompted the change (#128). + +- Rework documentation structure. Move out tutorial, examples and + reference doc from the `.mli` to multiple `.mld` pages. + +- `Arg.doc_alts` and `Arg.doc_alts_enum`, change the default rendering + to match the manpage convention which is to render these tokens in + bold. If you want to recover the previous rendering or were using + these functions outside man page rendering use an explicit + `~quoted:true` (the optional argument is available on earlier + versions). + +- The deprecated `Term.exit` and `Term.exit_status_of_result` now + require a `unit` result. This avoids various errors to go undetected. + Thanks to Thomas Leonard for the patch (#124). + +- Fix absent and default option values (`?none` string argument of `Arg.some`) + rendering in manpages: + + 1. They were not escaped, they now are. + 2. They where not rendered in bold, they now are. + 3. The documentation language was interpreted, it is no longer the case. + + If you were relying on the third point via `?none` of `Arg.some`, use the new + `?absent` optional argument of `Arg.info` instead. Besides a new + `Arg.some'` function is added to specify a value for `?none` instead + of a string. Thanks to David Allsopp for the patch (#111). + +- Documentation generation use: `…` (U+2026) instead of `...` for + ellipsis. See also UTF-8 manpage support below. + +- Documentation generation, improve command synopsis rendering on + commands with few options (i.e. mention them). + +- Documentation generation, drop section heading in the output if the section + is empty. + +### New `Cmd` module and deprecation of the `Term` evaluation interface + +This version of cmdliner deprecates the `Term.eval*` evaluation +functions and `Term.info` information values in favor of the new +`Cmdliner.Cmd` module. + +The `Cmd` module generalizes the existing sub command support to allow +arbitrarily nested sub commands each with its own man page and command +line syntax represented by a `Term.t` value. + +The mapping between the old interface and the new one should be rather +straightforward. In particular `Term.info` and `Cmd.info` have exactly +the same semantics and fields and a command value simply pairs a +command information with a term. + +However in this transition the following things are changed or added: + +* All default values of `Cmd.info` match those of `Term.info` except + for: + * The `?exits` argument which defaults to `Cmd.Exit.defaults` + rather than the empty list. + * The `?man_xrefs` which defaults to the list ``[`Main]`` rather + than the empty list (this means that by default sub commands + at any level automatically cross-reference the main command). + * The `?sdocs` argument which defaults to `Manpage.s_common_options` + rather than `Manpage.s_options`. + +* The `Cmd.Exit.some_error` code is added to `Cmd.Exit.defaults` + (which in turn is the default for `Cmd.info` see above). This is an + error code clients can use when they don't want to bother about + having precise exit codes. It is high so that low, meaningful, + codes can later be added without breaking a tool's compatibility. In + particular the convenience evaluation functions `Cmd.eval_result*` + use this code when they evaluate to an error. + +* If you relied on `?term_err` defaulting to `1` in the various + `Term.exit*` function, note that the new `Cmd.eval*` function use + `Exit.cli_error` as a default. You may want to explicitly specify + `1` instead if you use `Term.ret` with the `` `Error`` case + or `Term.term_result`. + +Finally be aware that if you replace, in an existing tool, an encoding +of sub commands as positional arguments you will effectively break the +command line compatibility of your tool since options can no longer be +specified before the sub commands, i.e. your tool synopsis moves from: + +``` +tool cmd [OPTION]… SUBCMD [ARG]… +``` +to +``` +tool cmd SUBCMD [OPTION]… [ARG]… +``` + +Thanks to Rudi Grinberg for prototyping the feature in #123. + +### UTF-8 manpage support + +It is now possible to write UTF-8 encoded text in your doc strings and +man pages. + +The man page renderer used on `--help` defaults to `mandoc` if +available, then uses `groff` and then defaults to `nroff`. Starting +with `mandoc` catches macOS whose `groff` as of 11.6 still doesn't +support UTF-8 input and struggles to render some Unicode characters. + +The invocations were also tweaked to remove the `-P-c` option which +entails that the default pager `less` is now invoked with the `-R` option. + +If you install UTF-8 encoded man pages output via `--help=groff`, in +`man` directories bear in mind that these pages will look garbled on +stock macOS (at least until 11.6). One way to work around is to +instruct your users to change the `NROFF` definition in +`/private/etc/man.conf` from: + + NROFF /usr/bin/groff -Wall -mtty-char -Tascii -mandoc -c + +to: + + NROFF /usr/bin/mandoc -Tutf8 -c + +Thanks to Antonin Décimo for his knowledge and helping with these +`man`gnificent intricacies (#27). + +v1.0.4 2019-06-14 Zagreb +------------------------ + +- Change the way `Error (_, e)` term evaluation results + are formatted. Instead of treating `e` as text, treat + it as formatted lines. +- Fix 4.08 `Pervasives` deprecation. +- Fix 4.03 String deprecations. +- Fix bootstrap build in absence of dynlink. +- Make the `Makefile` bootstrap build reproducible. + Thanks to Thomas Leonard for the patch. + +v1.0.3 2018-11-26 Zagreb +------------------------ + +- Add `Term.with_used_args`. Thanks to Jeremie Dimino for + the patch. +- Use `Makefile` bootstrap build in opam file. +- Drop ocamlbuild requirement for `Makefile` bootstrap build. +- Drop support for ocaml < 4.03.0 +- Dune build support. + +v1.0.2 2017-08-07 Zagreb +------------------------ + +- Don't remove the `Makefile` from the distribution. + +v1.0.1 2017-08-03 Zagreb +------------------------ + +- Add a `Makefile` to build and install cmdliner without `topkg` and + opam `.install` files. Helps bootstraping opam in OS package + managers. Thanks to Hendrik Tews for the patches. + +v1.0.0 2017-03-02 La Forclaz (VS) +--------------------------------- + +**IMPORTANT** The `Arg.converter` type is deprecated in favor of the +`Arg.conv` type. For this release both types are equal but the next +major release will drop the former and make the latter abstract. All +users are kindly requested to migrate to use the new type and **only** +via the new `Arg.[p]conv` and `Arg.conv_{parser,printer}` functions. + +- Allow terms to be used more than once in terms without tripping out + documentation generation (#77). Thanks to François Bobot and Gabriel + Radanne. +- Disallow defining the same option (resp. command) name twice via two + different arguments (resp. terms). Raises Invalid_argument, used + to be undefined behaviour (in practice, an arbitrary one would be + ignored). +- Improve converter API (see important message above). +- Add `Term.exit[_status]` and `Term.exit_status_of[_status]_result`. + improves composition with `Pervasives.exit`. +- Add `Term.term_result` and `Term.cli_parse_result` improves composition + with terms evaluating to `result` types. +- Add `Arg.parser_of_kind_of_string`. +- Change semantics of `Arg.pos_left` (see #76 for details). +- Deprecate `Term.man_format` in favor of `Arg.man_format`. +- Reserve the `--cmdliner` option for library use. This is unused for now + but will be in the future. +- Relicense from BSD3 to ISC. +- Safe-string support. +- Build depend on topkg. + +### End-user visible changes + +The following changes affect the end-user behaviour of all binaries using +cmdliner. + +- Required positional arguments. All missing required position + arguments are now reported to the end-user, in the correct + order (#39). Thanks to Dmitrii Kashin for the report. +- Optional arguments. All unknown and ambiguous optional argument + arguments are now reported to the end-user (instead of only + the first one). +- Change default behaviour of `--help[=FMT]` option. `FMT` no longer + defaults to `pager` if unspecified. It defaults to the new value + `auto` which prints the help as `pager` or `plain` whenever the + `TERM` environment variable is `dumb` or undefined (#43). At the API + level this changes the signature of the type `Term.ret` and values + `Term.ret`, `Term.man_format` (deprecated) and `Manpage.print` to add the + new `` `Auto`` case to manual formats. These are now represented by the + `Manpage.format` type rather than inlined polyvars. + +### Doc specification improvements and fixes + +- Add `?envs` optional argument to `Term.info`. Documents environment + variables that influence a term's evaluation and automatically + integrate them in the manual. +- Add `?exits` optional argument to `Term.info`. Documents exit statuses of + the program. Use `Term.default_exits` if you are using the new `Term.exit` + functions. +- Add `?man_xrefs` optional argument to `Term.info`. Documents + references to other manpages. Automatically formats a `SEE ALSO` section + in the manual. +- Add `Manpage.escape` to escape a string from the documentation markup + language. +- Add `Manpage.s_*` constants for standard man page section names. +- Add a `` `Blocks`` case to `Manpage.blocks` to allow block splicing + (#69). This avoids having to concatenate block lists at the + toplevel of your program. +- `Arg.env_var`, change default environment variable section to the + standard `ENVIRONMENT` manual section rather than `ENVIRONMENT + VARIABLES`. If you previously manually positioned that section in + your man page you will have to change the name. See also next point. +- Fix automatic placement of default environment variable section (#44) + whenever unspecified in the man page. +- Better automatic insertions of man page sections (#73). See the API + docs about manual specification. As a side effect the `NAME` section + can now also be overridden manually. +- Fix repeated environment variable printing for flags (#64). Thanks to + Thomas Gazagnaire for the report. +- Fix rendering of env vars in man pages, bold is standard (#71). +- Fix plain help formatting for commands with empty + description. Thanks to Maciek Starzyk for the patch. +- Fix (implement really) groff man page escaping (#48). +- Request `an` macros directly in the man page via `.mso` this + makes man pages self-describing and avoids having to call `groff` with + the `-man` option. +- Document required optional arguments as such (#82). Thanks to Isaac Hodes + for the report. + +### Doc language sanitization + +This release tries to bring sanity to the doc language. This may break +the rendering of some of your man pages. Thanks to Gabriel Scherer, +Ivan Gotovchits and Nicolás Ojeda Bär for the feedback. + +- It is only allowed to use the variables `$(var)` that are mentioned in + the docs (`$(docv)`, `$(opt)`, etc.) and the markup directives + `$({i,b},text)`. Any other unknown `$(var)` will generate errors + on standard error during documentation generation. +- Markup directives `$({i,b},text)` treat `text` as is, modulo escapes; + see next point. +- Characters `$`, `(`, `)` and `\` can respectively be escaped by `\$`, + `\(`, `\)` and `\\`. Escaping `$` and `\` is mandatory everywhere. + Escaping `)` is mandatory only in markup directives. Escaping `(` + is only here for your symmetric pleasure. Any other sequence of + character starting with a `\` is an illegal sequence. +- Variables `$(mname)` and `$(tname)` are now marked up with bold when + substituted. If you used to write `$(b,$(tname))` this will generate + an error on standard output, since `$` is not escaped in the markup + directive. Simply replace these by `$(tname)`. + +v0.9.8 2015-10-11 Cambridge (UK) +-------------------------------- + +- Bring back support for OCaml 3.12.0 +- Support for pre-formatted paragraphs in man pages. This adds a + ```Pre`` case to the `Manpage.block` type which can break existing + programs. Thanks to Guillaume Bury for suggesting and help. +- Support for environment variables. If an argument is absent from the + command line, its value can be read and parsed from an environment + variable. This adds an `env` optional argument to the `Arg.info` + function which can break existing programs. +- Support for new variables in option documentation strings. `$(opt)` + can be used to refer to the name of the option being documented and + `$(env)` for the name of the option's the environment variable. +- Deprecate `Term.pure` in favor of `Term.const`. +- Man page generation. Keep undefined variables untouched. Previously + a `$(undef)` would be turned into `undef`. +- Turn a few mysterious and spurious `Not_found` exceptions into + `Invalid_arg`. These can be triggered by client programming errors + (e.g. an unclosed variable in a documentation string). +- Positional arguments. Invoke the printer on the default (absent) + value only if needed. See Optional arguments in the release notes of + v0.9.6. + +v0.9.7 2015-02-06 La Forclaz (VS) +--------------------------------- + +- Build system, don't depend on `ocamlfind`. The package no longer + depends on ocamlfind. Thanks to Louis Gesbert for the patch. + +v0.9.6 2014-11-18 La Forclaz (VS) +--------------------------------- + +- Optional arguments. Invoke the printer on the default (absent) value + only if needed, i.e. if help is shown. Strictly speaking an + interface breaking change – for example if the absent value was lazy + it would be forced on each run. This is no longer the case. +- Parsed command line syntax: allow short flags to be specified + together under a single dash, possibly ending with a short option. + This allows to specify e.g. `tar -xvzf archive.tgz` or `tar + -xvzfarchive.tgz`. Previously this resulted in an error, all the + short flags had to be specified separately. Backward compatible in + the sense that only more command lines are parsed. Thanks to Hugo + Heuzard for the patch. +- End user error message improvements using heuristics and edit + distance search in the optional argument and sub command name + spaces. Thanks to Hugo Heuzard for the patch. +- Adds `Arg.doc_{quote,alts,alts_enum}`, documentation string + helpers. +- Adds the `Term.eval_peek_opts` function for advanced usage scenarios. +- The function `Arg.enum` now raises `Invalid_argument` if the + enumeration is empty. +- Improves help paging behaviour on Windows. Thanks to Romain Bardou + for the help. + + +v0.9.5 2014-07-04 Cambridge (UK) +-------------------------------- + +- Add variance annotation to Term.t. Thanks to Peter Zotov for suggesting. +- Fix section name formatting in plain text output. Thanks to Mikhail + Sobolev for reporting. + + +v0.9.4 2014-02-09 La Forclaz (VS) +--------------------------------- + +- Remove temporary files created for paged help. Thanks to Kaustuv Chaudhuri + for the suggestion. +- Avoid linking against `Oo` (was used to get program uuid). +- Check the environment for `$MANPAGER` as well. Thanks to Raphaël Proust + for the patch. +- OPAM friendly workflow and drop OASIS support. + + +v0.9.3 2013-01-04 La Forclaz (VS) +--------------------------------- + +- Allow user specified `SYNOPSIS` sections. + + +v0.9.2 2012-08-05 Lausanne +-------------------------- + +- OASIS 0.3.0 support. + + +v0.9.1 2012-03-17 La Forclaz (VS) +--------------------------------- + +- OASIS support. +- Fixed broken `Arg.pos_right`. +- Variables `$(tname)` and `$(mname)` can be used in a term's man + page to respectively refer to the term's name and the main term + name. +- Support for custom variable substitution in `Manpage.print`. +- Adds `Term.man_format`, to facilitate the definition of help commands. +- Rewrote the examples with a better and consistent style. + +Incompatible API changes: + +- The signature of `Term.eval` and `Term.eval_choice` changed to make + it more regular: the given term and its info must be tupled together + even for the main term and the tuple order was swapped to make it + consistent with the one used for arguments. + + +v0.9.0 2011-05-27 Lausanne +-------------------------- + +- First release. diff --git a/cmdliner/_doc-dir/LICENSE.md b/cmdliner/_doc-dir/LICENSE.md new file mode 100755 index 00000000..c4cd256d --- /dev/null +++ b/cmdliner/_doc-dir/LICENSE.md @@ -0,0 +1,13 @@ +Copyright (c) 2011 The cmdliner programmers + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/cmdliner/_doc-dir/README.md b/cmdliner/_doc-dir/README.md new file mode 100755 index 00000000..6e5ff4c1 --- /dev/null +++ b/cmdliner/_doc-dir/README.md @@ -0,0 +1,49 @@ +Cmdliner — Declarative definition of command line interfaces for OCaml +------------------------------------------------------------------------------- +v1.2.0 + +Cmdliner allows the declarative definition of command line interfaces +for OCaml. + +It provides a simple and compositional mechanism to convert command +line arguments to OCaml values and pass them to your functions. The +module automatically handles syntax errors, help messages and UNIX man +page generation. It supports programs with single or multiple commands +and respects most of the [POSIX][1] and [GNU][2] conventions. + +Cmdliner has no dependencies and is distributed under the ISC license. + +[1]: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html +[2]: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html + +Home page: http://erratique.ch/software/cmdliner + +## Installation + +Cmdliner can be installed with `opam`: + + opam install cmdliner + +If you don't use `opam` consult the [`opam`](opam) file for build +instructions. + + +## Documentation + +The documentation and API reference is automatically generated by from +the source interfaces. It can be consulted [online][doc] or via +`odig doc cmdliner`. + +[doc]: http://erratique.ch/software/cmdliner/doc/Cmdliner + + +## Sample programs + +If you installed Cmdliner with `opam` sample programs are located in +the directory `opam config var cmdliner:doc`. These programs define +the command line of some classic programs. + +In the distribution sample programs are located in the `test` +directory of the distribution. They can be built and run with: + + topkg build --tests true && topkg test diff --git a/cmdliner/_doc-dir/odoc-pages/cli.mld b/cmdliner/_doc-dir/odoc-pages/cli.mld new file mode 100755 index 00000000..35799333 --- /dev/null +++ b/cmdliner/_doc-dir/odoc-pages/cli.mld @@ -0,0 +1,121 @@ +{0:cmdline Command line interface} + +For tools evaluating a command without sub commands the most general +form of invocation is: + +{[ +tool [OPTION]… [ARG]… +]} + +The tool automatically reponds to the [--help] option by printing the +help. If a version string is provided in the +{{!Cmdliner.Cmd.val-info}command information}, it also automatically +responds to the [--version] option by printing this string on standard +output. + +Command line arguments are either {{!optargs}{e optional}} or +{{!posargs}{e positional}}. Both can be freely interleaved but since +[Cmdliner] accepts many optional forms this may result in +ambiguities. The special {{!posargs} token [--]} can be used to +resolve them; anything that follows it is treated as a positional +argument. + +Tools evaluating commands with sub commands have this form of invocation + +{[ +tool [COMMAND]… [OPTION]… [ARG]… +]} + +Commands automatically respond to the [--help] option by printing +their help. The sequence of [COMMAND] strings must be the first +strings following the tool name – as soon as an optional argument is +seen the search for a sub command stops. Command names may be specified by +a prefixe as long as they are not ambiguous. + +{1:optargs Optional arguments} + +An optional argument is specified on the command line by a {e name} +possibly followed by a {e value}. + +The name of an option can be short or long. + +{ul +{- A {e short} name is a dash followed by a single alphanumeric + character: [-h], [-q], [-I].} +{- A {e long} name is two dashes followed by alphanumeric + characters and dashes: [--help], [--silent], [--ignore-case].}} + +More than one name may refer to the same optional argument. For +example in a given program the names [-q], [--quiet] and [--silent] +may all stand for the same boolean argument indicating the program to +be quiet. Long names can be specified by any non ambiguous prefix. + +The value of an option can be specified in three different ways. + +{ul +{- As the next token on the command line: [-o a.out], [--output a.out].} +{- Glued to a short name: [-oa.out].} +{- Glued to a long name after an equal character: [--output=a.out].}} + +Glued forms are especially useful if the value itself starts with a +dash as is the case for negative numbers, [--min=-10]. + +An optional argument without a value is either a {e flag} (see +{!Cmdliner.Arg.flag}, {!Cmdliner.Arg.vflag}) or an optional argument with +an optional value (see the [~vopt] argument of {!Cmdliner.Arg.opt}). + +Short flags can be grouped together to share a single dash and the +group can end with a short option. For example assuming [-v] and +[-x] are flags and [-f] is a short option: + +{ul +{- [-vx] will be parsed as [-v -x].} +{- [-vxfopt] will be parsed as [-v -x -fopt].} +{- [-vxf opt] will be parsed as [-v -x -fopt].} +{- [-fvx] will be parsed as [-f=vx].}} + +{1:posargs Positional arguments} + +Positional arguments are tokens on the command line that are not +option names and are not the value of an optional argument. They are +numbered from left to right starting with zero. + +Since positional arguments may be mistaken as the optional value of an +optional argument or they may need to look like option names, anything +that follows the special token ["--"] on the command line is +considered to be a positional argument: + +{[ +tool --option -- we -are --all positional --argu=ments +]} + +{1:envlookup Environment variables} + +Non-required command line arguments can be backed up by an environment +variable. If the argument is absent from the command line and that +the environment variable is defined, its value is parsed using the +argument converter and defines the value of the argument. + +For {!Cmdliner.Arg.flag} and {!Cmdliner.Arg.flag_all} that do not have an +argument converter a boolean is parsed from the lowercased variable value +as follows: + +{ul +{- [""], ["false"], ["no"], ["n"] or ["0"] is [false].} +{- ["true"], ["yes"], ["y"] or ["1"] is [true].} +{- Any other string is an error.}} + +Note that environment variables are not supported for {!Cmdliner.Arg.vflag} and +{!Cmdliner.Arg.vflag_all}. + +{1:reserved Reserved option names} + +Using the cmdliner library puts the following constraints o + +{ul +{- The option name [--cmdliner] is reserved by the library.} +{- The option name [--help], (and [--version] if you specify a version + string) is reserved by the library. Using it as a term or option + name may result in undefined behaviour.} +{- Defining the same option or command name via two different + arguments or terms is illegal and raises [Invalid_argument].}} diff --git a/cmdliner/_doc-dir/odoc-pages/examples.mld b/cmdliner/_doc-dir/odoc-pages/examples.mld new file mode 100755 index 00000000..8ac88212 --- /dev/null +++ b/cmdliner/_doc-dir/odoc-pages/examples.mld @@ -0,0 +1,443 @@ +{0 Examples} + +The examples are self-contained, cut and paste them in a file to play +with them. + +{1:exrm A [rm] command} + +We define the command line interface of an [rm] command with the +synopsis: + +{v +rm [OPTION]… FILE… +v} + +The [-f], [-i] and [-I] flags define the prompt behaviour of [rm]. It +is represented in our program by the [prompt] type. If more than one +of these flags is present on the command line the last one takes +precedence. + +To implement this behaviour we map the presence of these flags to +values of the [prompt] type by using {!Cmdliner.Arg.vflag_all}. + +This argument will contain all occurrences of the flag on the command +line and we just take the {!Cmdliner.Arg.last} one to define our term +value. If there is no occurrence the last value of the default list +[[Always]] is taken. This means the default prompt behaviour is [Always]. + +{[ +(* Implementation of the command, we just print the args. *) + +type prompt = Always | Once | Never +let prompt_str = function +| Always -> "always" | Once -> "once" | Never -> "never" + +let rm prompt recurse files = + Printf.printf "prompt = %s\nrecurse = %B\nfiles = %s\n" + (prompt_str prompt) recurse (String.concat ", " files) + +(* Command line interface *) + +open Cmdliner + +let files = Arg.(non_empty & pos_all file [] & info [] ~docv:"FILE") +let prompt = + let always = + let doc = "Prompt before every removal." in + Always, Arg.info ["i"] ~doc + in + let never = + let doc = "Ignore nonexistent files and never prompt." in + Never, Arg.info ["f"; "force"] ~doc + in + let once = + let doc = "Prompt once before removing more than three files, or when + removing recursively. Less intrusive than $(b,-i), while + still giving protection against most mistakes." + in + Once, Arg.info ["I"] ~doc + in + Arg.(last & vflag_all [Always] [always; never; once]) + +let recursive = + let doc = "Remove directories and their contents recursively." in + Arg.(value & flag & info ["r"; "R"; "recursive"] ~doc) + +let cmd = + let doc = "Remove files or directories" in + let man = [ + `S Manpage.s_description; + `P "$(tname) removes each specified $(i,FILE). By default it does not + remove directories, to also remove them and their contents, use the + option $(b,--recursive) ($(b,-r) or $(b,-R))."; + `P "To remove a file whose name starts with a $(b,-), for example + $(b,-foo), use one of these commands:"; + `Pre "$(mname) $(b,-- -foo)"; `Noblank; + `Pre "$(mname) $(b,./-foo)"; + `P "$(tname) removes symbolic links, not the files referenced by the + links."; + `S Manpage.s_bugs; `P "Report bugs to ."; + `S Manpage.s_see_also; `P "$(b,rmdir)(1), $(b,unlink)(2)" ] + in + let info = Cmd.info "rm" ~version:"v1.2.0" ~doc ~man in + Cmd.v info Term.(const rm $ prompt $ recursive $ files) + +let main () = exit (Cmd.eval cmd) +let () = main () +]} + +{1:excp A [cp] command} + +We define the command line interface of a [cp] command with the synopsis: +{v +cp [OPTION]… SOURCE… DEST +v} + +The [DEST] argument must be a directory if there is more than one +[SOURCE]. This constraint is too complex to be expressed by the +combinators of {!Cmdliner.Arg}. + +Hence we just give [DEST] the {!Cmdliner.Arg.string} type and verify the +constraint at the beginning of the implementation of [cp]. If the +constraint is unsatisfied we return an [`Error] result. By using +{!Cmdliner.Term.val-ret} on the lifted result [cp_t] of [cp], +[Cmdliner] handles the error reporting. + +{[ +(* Implementation, we check the dest argument and print the args *) + +let cp verbose recurse force srcs dest = + let many = List.length srcs > 1 in + if many && (not (Sys.file_exists dest) || not (Sys.is_directory dest)) + then `Error (false, dest ^ ": not a directory") else + `Ok (Printf.printf + "verbose = %B\nrecurse = %B\nforce = %B\nsrcs = %s\ndest = %s\n" + verbose recurse force (String.concat ", " srcs) dest) + +(* Command line interface *) + +open Cmdliner + +let verbose = + let doc = "Print file names as they are copied." in + Arg.(value & flag & info ["v"; "verbose"] ~doc) + +let recurse = + let doc = "Copy directories recursively." in + Arg.(value & flag & info ["r"; "R"; "recursive"] ~doc) + +let force = + let doc = "If a destination file cannot be opened, remove it and try again."in + Arg.(value & flag & info ["f"; "force"] ~doc) + +let srcs = + let doc = "Source file(s) to copy." in + Arg.(non_empty & pos_left ~rev:true 0 file [] & info [] ~docv:"SOURCE" ~doc) + +let dest = + let doc = "Destination of the copy. Must be a directory if there is more \ + than one $(i,SOURCE)." in + let docv = "DEST" in + Arg.(required & pos ~rev:true 0 (some string) None & info [] ~docv ~doc) + +let cmd = + let doc = "Copy files" in + let man_xrefs = + [ `Tool "mv"; `Tool "scp"; `Page ("umask", 2); `Page ("symlink", 7) ] + in + let man = + [ `S Manpage.s_bugs; + `P "Email them to ."; ] + in + let info = Cmd.info "cp" ~version:"v1.2.0" ~doc ~man ~man_xrefs in + Cmd.v info Term.(ret (const cp $ verbose $ recurse $ force $ srcs $ dest)) + + +let main () = exit (Cmd.eval cmd) +let () = main () +]} + +{1:extail A [tail] command} + +We define the command line interface of a [tail] command with the +synopsis: + +{v +tail [OPTION]… [FILE]… +v} + +The [--lines] option whose value specifies the number of last lines to +print has a special syntax where a [+] prefix indicates to start +printing from that line number. In the program this is represented by +the [loc] type. We define a custom [loc_arg] +{{!Cmdliner.Arg.type-conv}argument converter} for this option. + +The [--follow] option has an optional enumerated value. The argument +converter [follow], created with {!Cmdliner.Arg.enum} parses the +option value into the enumeration. By using {!Cmdliner.Arg.some} and +the [~vopt] argument of {!Cmdliner.Arg.opt}, the term corresponding to +the option [--follow] evaluates to [None] if [--follow] is absent from +the command line, to [Some Descriptor] if present but without a value +and to [Some v] if present with a value [v] specified. + +{[ +(* Implementation of the command, we just print the args. *) + +type loc = bool * int +type verb = Verbose | Quiet +type follow = Name | Descriptor + +let str = Printf.sprintf +let opt_str sv = function None -> "None" | Some v -> str "Some(%s)" (sv v) +let loc_str (rev, k) = if rev then str "%d" k else str "+%d" k +let follow_str = function Name -> "name" | Descriptor -> "descriptor" +let verb_str = function Verbose -> "verbose" | Quiet -> "quiet" + +let tail lines follow verb pid files = + Printf.printf + "lines = %s\nfollow = %s\nverb = %s\npid = %s\nfiles = %s\n" + (loc_str lines) (opt_str follow_str follow) (verb_str verb) + (opt_str string_of_int pid) (String.concat ", " files) + +(* Command line interface *) + +open Cmdliner + +let loc_arg = + let parse s = + try + if s <> "" && s.[0] <> '+' + then Ok (true, int_of_string s) + else Ok (false, int_of_string (String.sub s 1 (String.length s - 1))) + with Failure _ -> Error (`Msg "unable to parse integer") + in + let print ppf p = Format.fprintf ppf "%s" (loc_str p) in + Arg.conv ~docv:"N" (parse, print) + +let lines = + let doc = "Output the last $(docv) lines or use $(i,+)$(docv) to start \ + output after the $(i,N)-1th line." + in + Arg.(value & opt loc_arg (true, 10) & info ["n"; "lines"] ~docv:"N" ~doc) + +let follow = + let doc = "Output appended data as the file grows. $(docv) specifies how \ + the file should be tracked, by its $(b,name) or by its \ + $(b,descriptor)." + in + let follow = Arg.enum ["name", Name; "descriptor", Descriptor] in + Arg.(value & opt (some follow) ~vopt:(Some Descriptor) None & + info ["f"; "follow"] ~docv:"ID" ~doc) + +let verb = + let quiet = + let doc = "Never output headers giving file names." in + Quiet, Arg.info ["q"; "quiet"; "silent"] ~doc + in + let verbose = + let doc = "Always output headers giving file names." in + Verbose, Arg.info ["v"; "verbose"] ~doc + in + Arg.(last & vflag_all [Quiet] [quiet; verbose]) + +let pid = + let doc = "With -f, terminate after process $(docv) dies." in + Arg.(value & opt (some int) None & info ["pid"] ~docv:"PID" ~doc) + +let files = Arg.(value & (pos_all non_dir_file []) & info [] ~docv:"FILE") + +let cmd = + let doc = "Display the last part of a file" in + let man = [ + `S Manpage.s_description; + `P "$(tname) prints the last lines of each $(i,FILE) to standard output. If + no file is specified reads standard input. The number of printed + lines can be specified with the $(b,-n) option."; + `S Manpage.s_bugs; + `P "Report them to ."; + `S Manpage.s_see_also; + `P "$(b,cat)(1), $(b,head)(1)" ] + in + let info = Cmd.info "tail" ~version:"v1.2.0" ~doc ~man in + Cmd.v info Term.(const tail $ lines $ follow $ verb $ pid $ files) + + +let main () = exit (Cmd.eval cmd) +let () = main () +]} + +{1:exdarcs A [darcs] command} + +We define the command line interface of a [darcs] command with the +synopsis: + +{v +darcs [COMMAND] … +v} + +The [--debug], [-q], [-v] and [--prehook] options are available in +each command. To avoid having to pass them individually to each +command we gather them in a record of type [copts]. By lifting the +record constructor [copts] into the term [copts_t] we now have a term +that we can pass to the commands to stand for an argument of type +[copts]. These options are documented in a section called [COMMON +OPTIONS], since we also want to put [--help] and [--version] in this +section, the term information of commands makes a judicious use of the +[sdocs] parameter of {!Cmdliner.Term.val-info}. + +The [help] command shows help about commands or other topics. The help +shown for commands is generated by [Cmdliner] by making an appropriate +use of {!Cmdliner.Term.val-ret} on the lifted [help] function. + +If the program is invoked without a command we just want to show the +help of the program as printed by [Cmdliner] with [--help]. This is +done by the [default_cmd] term. + +{[ +(* Implementations, just print the args. *) + +type verb = Normal | Quiet | Verbose +type copts = { debug : bool; verb : verb; prehook : string option } + +let str = Printf.sprintf +let opt_str sv = function None -> "None" | Some v -> str "Some(%s)" (sv v) +let opt_str_str = opt_str (fun s -> s) +let verb_str = function + | Normal -> "normal" | Quiet -> "quiet" | Verbose -> "verbose" + +let pr_copts oc copts = Printf.fprintf oc + "debug = %B\nverbosity = %s\nprehook = %s\n" + copts.debug (verb_str copts.verb) (opt_str_str copts.prehook) + +let initialize copts repodir = Printf.printf + "%arepodir = %s\n" pr_copts copts repodir + +let record copts name email all ask_deps files = Printf.printf + "%aname = %s\nemail = %s\nall = %B\nask-deps = %B\nfiles = %s\n" + pr_copts copts (opt_str_str name) (opt_str_str email) all ask_deps + (String.concat ", " files) + +let help copts man_format cmds topic = match topic with +| None -> `Help (`Pager, None) (* help about the program. *) +| Some topic -> + let topics = "topics" :: "patterns" :: "environment" :: cmds in + let conv, _ = Cmdliner.Arg.enum (List.rev_map (fun s -> (s, s)) topics) in + match conv topic with + | `Error e -> `Error (false, e) + | `Ok t when t = "topics" -> List.iter print_endline topics; `Ok () + | `Ok t when List.mem t cmds -> `Help (man_format, Some t) + | `Ok t -> + let page = (topic, 7, "", "", ""), [`S topic; `P "Say something";] in + `Ok (Cmdliner.Manpage.print man_format Format.std_formatter page) + +open Cmdliner + +(* Help sections common to all commands *) + +let help_secs = [ + `S Manpage.s_common_options; + `P "These options are common to all commands."; + `S "MORE HELP"; + `P "Use $(mname) $(i,COMMAND) --help for help on a single command.";`Noblank; + `P "Use $(mname) $(b,help patterns) for help on patch matching."; `Noblank; + `P "Use $(mname) $(b,help environment) for help on environment variables."; + `S Manpage.s_bugs; `P "Check bug reports at http://bugs.example.org.";] + +(* Options common to all commands *) + +let copts debug verb prehook = { debug; verb; prehook } +let copts_t = + let docs = Manpage.s_common_options in + let debug = + let doc = "Give only debug output." in + Arg.(value & flag & info ["debug"] ~docs ~doc) + in + let verb = + let doc = "Suppress informational output." in + let quiet = Quiet, Arg.info ["q"; "quiet"] ~docs ~doc in + let doc = "Give verbose output." in + let verbose = Verbose, Arg.info ["v"; "verbose"] ~docs ~doc in + Arg.(last & vflag_all [Normal] [quiet; verbose]) + in + let prehook = + let doc = "Specify command to run before this $(mname) command." in + Arg.(value & opt (some string) None & info ["prehook"] ~docs ~doc) + in + Term.(const copts $ debug $ verb $ prehook) + +(* Commands *) + +let sdocs = Manpage.s_common_options + +let initialize_cmd = + let repodir = + let doc = "Run the program in repository directory $(docv)." in + Arg.(value & opt file Filename.current_dir_name & info ["repodir"] + ~docv:"DIR" ~doc) + in + let doc = "make the current directory a repository" in + let man = [ + `S Manpage.s_description; + `P "Turns the current directory into a Darcs repository. Any + existing files and subdirectories become …"; + `Blocks help_secs; ] + in + let info = Cmd.info "initialize" ~doc ~sdocs ~man in + Cmd.v info Term.(const initialize $ copts_t $ repodir) + +let record_cmd = + let pname = + let doc = "Name of the patch." in + Arg.(value & opt (some string) None & info ["m"; "patch-name"] ~docv:"NAME" + ~doc) + in + let author = + let doc = "Specifies the author's identity." in + Arg.(value & opt (some string) None & info ["A"; "author"] ~docv:"EMAIL" + ~doc) + in + let all = + let doc = "Answer yes to all patches." in + Arg.(value & flag & info ["a"; "all"] ~doc) + in + let ask_deps = + let doc = "Ask for extra dependencies." in + Arg.(value & flag & info ["ask-deps"] ~doc) + in + let files = Arg.(value & (pos_all file) [] & info [] ~docv:"FILE or DIR") in + let doc = "create a patch from unrecorded changes" in + let man = + [`S Manpage.s_description; + `P "Creates a patch from changes in the working tree. If you specify + a set of files …"; + `Blocks help_secs; ] + in + let info = Cmd.info "record" ~doc ~sdocs ~man in + Cmd.v info + Term.(const record $ copts_t $ pname $ author $ all $ ask_deps $ files) + +let help_cmd = + let topic = + let doc = "The topic to get help on. $(b,topics) lists the topics." in + Arg.(value & pos 0 (some string) None & info [] ~docv:"TOPIC" ~doc) + in + let doc = "display help about darcs and darcs commands" in + let man = + [`S Manpage.s_description; + `P "Prints help about darcs commands and other subjects…"; + `Blocks help_secs; ] + in + let info = Cmd.info "help" ~doc ~man in + Cmd.v info + Term.(ret (const help $ copts_t $ Arg.man_format $ Term.choice_names $ + topic)) + +let main_cmd = + let doc = "a revision control system" in + let man = help_secs in + let info = Cmd.info "darcs" ~version:"v1.2.0" ~doc ~sdocs ~man in + let default = Term.(ret (const (fun _ -> `Help (`Pager, None)) $ copts_t)) in + Cmd.group info ~default [initialize_cmd; record_cmd; help_cmd] + +let () = exit (Cmd.eval main_cmd) +]} diff --git a/cmdliner/_doc-dir/odoc-pages/index.mld b/cmdliner/_doc-dir/odoc-pages/index.mld new file mode 100755 index 00000000..962dd49f --- /dev/null +++ b/cmdliner/_doc-dir/odoc-pages/index.mld @@ -0,0 +1,34 @@ +{0 Cmdliner {%html: v1.2.0%}} + +[Cmdliner] provides a simple and compositional mechanism +to convert command line arguments to OCaml values and pass them to +your functions. + +The library automatically handles syntax errors, help messages and +UNIX man page generation. It supports programs with single or multiple +commands (like [git]) and respect most of the +{{:http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html} +POSIX} and +{{:http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html} +GNU} conventions. + +{1:manuals Manuals} + +The following manuals are available. + +{ul +{- The {{!page-tutorial}tutorial} gets you through the steps to write + your first command line interface with Cmdliner.} +{- The {{!page-cli}Command line interface manual} describes how command + lines and environment variables are parsed by Cmdliner.} +{- {{!page-tool_man}Tool man pages} describes how Cmdliner generates + man pages for your tools and how you can format them.} +{- The {{!page-examples}examples page} has a few annoted examples that + show to express the command line interface of a few classic tools with + Cmdliner}} + +{1:api API} + +{!modules: +Cmdliner +} diff --git a/cmdliner/_doc-dir/odoc-pages/tool_man.mld b/cmdliner/_doc-dir/odoc-pages/tool_man.mld new file mode 100755 index 00000000..7029d346 --- /dev/null +++ b/cmdliner/_doc-dir/odoc-pages/tool_man.mld @@ -0,0 +1,70 @@ +{0:tool_man Tool man pages} + +{1:manual Manual} + +Man page sections for a command are printed in the order specified by +manual as given to {!Cmdliner.Cmd.val-info}. Unless specified +explicitly in the command's manual the following sections are +automatically created and populated for you: + +{ul +{- {{!Cmdliner.Manpage.s_name}[NAME]} section.} +{- {{!Cmdliner.Manpage.s_synopsis}[SYNOPSIS]} section.}} + +The various [doc] documentation strings specified by the command's +term arguments get inserted at the end of the documentation section +they respectively mention in their [docs] argument: + +{ol +{- For commands, see {!Cmdliner.Cmd.val-info}.} +{- For positional arguments, see {!Cmdliner.Arg.type-info}. Those are listed iff + both the [docv] and [doc] string is specified by {!Cmdliner.Arg.val-info}.} +{- For optional arguments, see {!Cmdliner.Arg.val-info}.} +{- For exit statuses, see {!Cmdliner.Cmd.Exit.val-info}.} +{- For environment variables, see + {!Cmdliner.Arg.val-env_var} and {!Cmdliner.Cmd.Env.val-info}.}} + +If a [docs] section name is mentioned and does not exist in the command's +manual, an empty section is created for it, after which the [doc] strings +are inserted, possibly prefixed by boilerplate text (e.g. for +{!Cmdliner.Manpage.s_environment} and {!Cmdliner.Manpage.s_exit_status}). + +If the created section is: +{ul +{- {{!Cmdliner.Manpage.standard_sections}standard}, it + is inserted at the right place in the order specified + {{!Cmdliner.Manpage.standard_sections}here}, but after a + possible non-standard + section explicitly specified by the command's manual since the latter + get the order number of the last previously specified standard section + or the order of {!Cmdliner.Manpage.s_synopsis} if there is no such section.} +{- non-standard, it is inserted before the {!Cmdliner.Manpage.s_commands} + section or the first subsequent existing standard section if it + doesn't exist. Taking advantage of this behaviour is discouraged, + you should declare manually your non standard section in the command's + manual page.}} + +Finally note that the header of empty sections are dropped from the +output. This allows you to share section placements among many +commands and render them only if something actually gets inserted in +it. + +{1:doclang Documentation markup language} + +Manpage {{!Cmdliner.Manpage.block}blocks} and doc strings support the +following markup language. + +{ul +{- Markup directives [$(i,text)] and [$(b,text)], where [text] is raw + text respectively rendered in italics and bold.} +{- Outside markup directives, context dependent variables of the form + [$(var)] are substituted by marked up data. For example in a term's + man page [$(tname)] is substituted by the term name in bold.} +{- Characters $, (, ) and \ can respectively be escaped by \$, \(, \) + and \\ (in OCaml strings this will be ["\\$"], ["\\("], ["\\)"], + ["\\\\"]). Escaping $ and \ is mandatory everywhere. Escaping ) is + mandatory only in markup directives. Escaping ( is only here for + your symmetric pleasure. Any other sequence of characters starting + with a \ is an illegal character sequence.} +{- Referring to unknown markup directives or variables will generate + errors on standard error during documentation generation.}} diff --git a/cmdliner/_doc-dir/odoc-pages/tutorial.mld b/cmdliner/_doc-dir/odoc-pages/tutorial.mld new file mode 100755 index 00000000..a950e664 --- /dev/null +++ b/cmdliner/_doc-dir/odoc-pages/tutorial.mld @@ -0,0 +1,203 @@ +{0:tutorial Tutorial} + +{1:started Getting started} + +With [Cmdliner] your tool's [main] function evaluates a command. + +A command is a value of type {!Cmdliner.Cmd.t} which gathers a command +name and a term of type {!Cmdliner.Term.t}. A term is an expression to +be evaluated. The type parameter of the term (and the command) +indicates the type of the result of the evaluation. + +One way to create terms is by lifting regular OCaml values with +{!Cmdliner.Term.const}. Terms can be applied to terms evaluating to +functional values with {!Cmdliner.Term.($)}. + +For example, in a [revolt.ml] file, for the function: + +{[ +let revolt () = print_endline "Revolt!" +]} + +the term : + +{[ +open Cmdliner + +let revolt_t = Term.(const revolt $ const ()) +]} + +is a term that evaluates to the result (and effect) of the [revolt] +function. This term can be attached to a command: + +{[ +let cmd = Cmd.v (Cmd.info "revolt") revolt_t +]} + +and evaluated with {!Cmdliner.Cmd.val-eval}: +{[ +let () = exit (Cmd.eval cmd) +]} + +This defines a command line tool named ["revolt"] (this name will be +used in error reporting and documentation generation), without command +line arguments, that just prints ["Revolt!"] on [stdout]. + +{[ +> ocamlfind ocamlopt -linkpkg -package cmdliner -o revolt revolt.ml +> ./revolt +Revolt! +]} + +The combinators in the {!Cmdliner.Arg} module allow to extract command +line arguments as terms. These terms can then be applied to lifted +OCaml functions to be evaluated. + +Terms corresponding to command line argument data that are part of a +term evaluation implicitly define a command line syntax. We show this +on an concrete example. + +In a [chorus.ml] file, consider the [chorus] function that prints +repeatedly a given message : + +{[ +let chorus count msg = for i = 1 to count do print_endline msg done +]} + +we want to make it available from the command line with the synopsis: + +{[ +chorus [-c COUNT | --count=COUNT] [MSG] +]} + +where [COUNT] defaults to [10] and [MSG] defaults to ["Revolt!"]. We +first define a term corresponding to the [--count] option: + +{[ +let count = + let doc = "Repeat the message $(docv) times." in + Arg.(value & opt int 10 & info ["c"; "count"] ~docv:"COUNT" ~doc) +]} + +This says that [count] is a term that evaluates to the value of an +optional argument of type [int] that defaults to [10] if unspecified +and whose option name is either [-c] or [--count]. The arguments [doc] +and [docv] are used to generate the option's man page information. + +The term for the positional argument [MSG] is: + +{[ +let msg = + let env = + let doc = "Overrides the default message to print." in + Cmd.Env.info "CHORUS_MSG" ~doc + in + let doc = "The message to print." in + Arg.(value & pos 0 string "Revolt!" & info [] ~env ~docv:"MSG" ~doc) +]} + +which says that [msg] is a term whose value is the positional argument +at index [0] of type [string] and defaults to ["Revolt!"] or the +value of the environment variable [CHORUS_MSG] if the argument is +unspecified on the command line. Here again [doc] and [docv] are used +for the man page information. + +The term for executing [chorus] with these command line arguments is : + +{[ +let chorus_t = Term.(const chorus $ count $ msg) +]} + +We are now ready to define the [main] function of our tool: + +{[ +let cmd = + let doc = "print a customizable message repeatedly" in + let man = [ + `S Manpage.s_bugs; + `P "Email bug reports to ." ] + in + let info = Cmd.info "chorus" ~version:"%‌%VERSION%%" ~doc ~man in + Cmd.v info chorus_t + +let main () = exit (Cmd.eval cmd) +let () = main () +]} + +The [info] value created with {!Cmdliner.Cmd.val-info} gives more +information about the term we execute and is used to generate the +tool's man page. Since we provided a [~version] string, the tool +will automatically respond to the [--version] option by printing this +string. + +A tool using {!Cmdliner.Cmd.val-eval} always responds to the [--help] +option by showing the tool's man page generated using the information +you provided with {!Cmdliner.Cmd.val-info} and +{!Cmdliner.Arg.val-info}. Here is the output generated by our +example: + +{v +> ocamlfind ocamlopt -linkpkg -package cmdliner -o chorus chorus.ml +> ./chorus --help +NAME + chorus - Print a customizable message repeatedly + +SYNOPSIS + chorus [--count=COUNT] [OPTION]… [MSG] + +ARGUMENTS + MSG (absent=Revolt! or CHORUS_MSG env) + The message to print. + +OPTIONS + -c COUNT, --count=COUNT (absent=10) + Repeat the message COUNT times. + +COMMON OPTIONS + --help[=FMT] (default=auto) + Show this help in format FMT. The value FMT must be one of auto, + pager, groff or plain. With auto, the format is pager or plain + whenever the TERM env var is dumb or undefined. + + --version + Show version information. + +EXIT STATUS + chorus exits with the following status: + + 0 on success. + + 123 on indiscriminate errors reported on standard error. + + 124 on command line parsing errors. + + 125 on unexpected internal errors (bugs). + +ENVIRONMENT + These environment variables affect the execution of chorus: + + CHORUS_MSG + Overrides the default message to print. + +BUGS + Email bug reports to . +v} + +If a pager is available, this output is written to a pager. This help +is also available in plain text or in the +{{:http://www.gnu.org/software/groff/groff.html}groff} man page format +by invoking the program with the option [--help=plain] or +[--help=groff]. + +For examples of more complex command line definitions look and run +the {{!page-examples}examples}. + +{1:subcommands Sub commands} + +[Cmdliner] also provides support for programs like [git] that have sub +commands each with their own command line syntax and manual: + +{[tool [COMMAND]… [OPTION]… ARG…]} + +These sub commands are defined by grouping them under a parent command +via the {!Cmdliner.Cmd.group} function. diff --git a/cmdliner/cli.html b/cmdliner/cli.html new file mode 100644 index 00000000..95f41a5d --- /dev/null +++ b/cmdliner/cli.html @@ -0,0 +1,2 @@ + +cli (cmdliner.cli)

Command line interface

For tools evaluating a command without sub commands the most general form of invocation is:

tool [OPTION]… [ARG]…

The tool automatically reponds to the --help option by printing the help. If a version string is provided in the command information, it also automatically responds to the --version option by printing this string on standard output.

Command line arguments are either optional or positional. Both can be freely interleaved but since Cmdliner accepts many optional forms this may result in ambiguities. The special token -- can be used to resolve them; anything that follows it is treated as a positional argument.

Tools evaluating commands with sub commands have this form of invocation

tool [COMMAND]… [OPTION]… [ARG]…

Commands automatically respond to the --help option by printing their help. The sequence of COMMAND strings must be the first strings following the tool name – as soon as an optional argument is seen the search for a sub command stops. Command names may be specified by a prefixe as long as they are not ambiguous.

Optional arguments

An optional argument is specified on the command line by a name possibly followed by a value.

The name of an option can be short or long.

  • A short name is a dash followed by a single alphanumeric character: -h, -q, -I.
  • A long name is two dashes followed by alphanumeric characters and dashes: --help, --silent, --ignore-case.

More than one name may refer to the same optional argument. For example in a given program the names -q, --quiet and --silent may all stand for the same boolean argument indicating the program to be quiet. Long names can be specified by any non ambiguous prefix.

The value of an option can be specified in three different ways.

  • As the next token on the command line: -o a.out, --output a.out.
  • Glued to a short name: -oa.out.
  • Glued to a long name after an equal character: --output=a.out.

Glued forms are especially useful if the value itself starts with a dash as is the case for negative numbers, --min=-10.

An optional argument without a value is either a flag (see Cmdliner.Arg.flag, Cmdliner.Arg.vflag) or an optional argument with an optional value (see the ~vopt argument of Cmdliner.Arg.opt).

Short flags can be grouped together to share a single dash and the group can end with a short option. For example assuming -v and -x are flags and -f is a short option:

  • -vx will be parsed as -v -x.
  • -vxfopt will be parsed as -v -x -fopt.
  • -vxf opt will be parsed as -v -x -fopt.
  • -fvx will be parsed as -f=vx.

Positional arguments

Positional arguments are tokens on the command line that are not option names and are not the value of an optional argument. They are numbered from left to right starting with zero.

Since positional arguments may be mistaken as the optional value of an optional argument or they may need to look like option names, anything that follows the special token "--" on the command line is considered to be a positional argument:

tool --option -- we -are --all positional --argu=ments

Environment variables

Non-required command line arguments can be backed up by an environment variable. If the argument is absent from the command line and that the environment variable is defined, its value is parsed using the argument converter and defines the value of the argument.

For Cmdliner.Arg.flag and Cmdliner.Arg.flag_all that do not have an argument converter a boolean is parsed from the lowercased variable value as follows:

  • "", "false", "no", "n" or "0" is false.
  • "true", "yes", "y" or "1" is true.
  • Any other string is an error.

Note that environment variables are not supported for Cmdliner.Arg.vflag and Cmdliner.Arg.vflag_all.

Reserved option names

Using the cmdliner library puts the following constraints o

  • The option name --cmdliner is reserved by the library.
  • The option name --help, (and --version if you specify a version string) is reserved by the library. Using it as a term or option name may result in undefined behaviour.
  • Defining the same option or command name via two different arguments or terms is illegal and raises Invalid_argument.
diff --git a/cmdliner/examples.html b/cmdliner/examples.html new file mode 100644 index 00000000..5fa49cbe --- /dev/null +++ b/cmdliner/examples.html @@ -0,0 +1,337 @@ + +examples (cmdliner.examples)

Examples

The examples are self-contained, cut and paste them in a file to play with them.

A rm command

We define the command line interface of an rm command with the synopsis:

rm [OPTION]… FILE…

The -f, -i and -I flags define the prompt behaviour of rm. It is represented in our program by the prompt type. If more than one of these flags is present on the command line the last one takes precedence.

To implement this behaviour we map the presence of these flags to values of the prompt type by using Cmdliner.Arg.vflag_all.

This argument will contain all occurrences of the flag on the command line and we just take the Cmdliner.Arg.last one to define our term value. If there is no occurrence the last value of the default list [Always] is taken. This means the default prompt behaviour is Always.

(* Implementation of the command, we just print the args. *)
+
+type prompt = Always | Once | Never
+let prompt_str = function
+| Always -> "always" | Once -> "once" | Never -> "never"
+
+let rm prompt recurse files =
+  Printf.printf "prompt = %s\nrecurse = %B\nfiles = %s\n"
+    (prompt_str prompt) recurse (String.concat ", " files)
+
+(* Command line interface *)
+
+open Cmdliner
+
+let files = Arg.(non_empty & pos_all file [] & info [] ~docv:"FILE")
+let prompt =
+  let always =
+    let doc = "Prompt before every removal." in
+    Always, Arg.info ["i"] ~doc
+  in
+  let never =
+    let doc = "Ignore nonexistent files and never prompt." in
+    Never, Arg.info ["f"; "force"] ~doc
+  in
+  let once =
+    let doc = "Prompt once before removing more than three files, or when
+               removing recursively. Less intrusive than $(b,-i), while
+               still giving protection against most mistakes."
+    in
+    Once, Arg.info ["I"] ~doc
+  in
+  Arg.(last & vflag_all [Always] [always; never; once])
+
+let recursive =
+  let doc = "Remove directories and their contents recursively." in
+  Arg.(value & flag & info ["r"; "R"; "recursive"] ~doc)
+
+let cmd =
+  let doc = "Remove files or directories" in
+  let man = [
+    `S Manpage.s_description;
+    `P "$(tname) removes each specified $(i,FILE). By default it does not
+        remove directories, to also remove them and their contents, use the
+        option $(b,--recursive) ($(b,-r) or $(b,-R)).";
+    `P "To remove a file whose name starts with a $(b,-), for example
+        $(b,-foo), use one of these commands:";
+    `Pre "$(mname) $(b,-- -foo)"; `Noblank;
+    `Pre "$(mname) $(b,./-foo)";
+    `P "$(tname) removes symbolic links, not the files referenced by the
+        links.";
+    `S Manpage.s_bugs; `P "Report bugs to <bugs@example.org>.";
+    `S Manpage.s_see_also; `P "$(b,rmdir)(1), $(b,unlink)(2)" ]
+  in
+  let info = Cmd.info "rm" ~version:"v1.2.0" ~doc ~man in
+  Cmd.v info Term.(const rm $ prompt $ recursive $ files)
+
+let main () = exit (Cmd.eval cmd)
+let () = main ()

A cp command

We define the command line interface of a cp command with the synopsis:

cp [OPTION]… SOURCE… DEST

The DEST argument must be a directory if there is more than one SOURCE. This constraint is too complex to be expressed by the combinators of Cmdliner.Arg.

Hence we just give DEST the Cmdliner.Arg.string type and verify the constraint at the beginning of the implementation of cp. If the constraint is unsatisfied we return an `Error result. By using Cmdliner.Term.ret on the lifted result cp_t of cp, Cmdliner handles the error reporting.

(* Implementation, we check the dest argument and print the args *)
+
+let cp verbose recurse force srcs dest =
+  let many = List.length srcs > 1 in
+  if many && (not (Sys.file_exists dest) || not (Sys.is_directory dest))
+  then `Error (false, dest ^ ": not a directory") else
+  `Ok (Printf.printf
+         "verbose = %B\nrecurse = %B\nforce = %B\nsrcs = %s\ndest = %s\n"
+         verbose recurse force (String.concat ", " srcs) dest)
+
+(* Command line interface *)
+
+open Cmdliner
+
+let verbose =
+  let doc = "Print file names as they are copied." in
+  Arg.(value & flag & info ["v"; "verbose"] ~doc)
+
+let recurse =
+  let doc = "Copy directories recursively." in
+  Arg.(value & flag & info ["r"; "R"; "recursive"] ~doc)
+
+let force =
+  let doc = "If a destination file cannot be opened, remove it and try again."in
+  Arg.(value & flag & info ["f"; "force"] ~doc)
+
+let srcs =
+  let doc = "Source file(s) to copy." in
+  Arg.(non_empty & pos_left ~rev:true 0 file [] & info [] ~docv:"SOURCE" ~doc)
+
+let dest =
+  let doc = "Destination of the copy. Must be a directory if there is more \
+             than one $(i,SOURCE)." in
+  let docv = "DEST" in
+  Arg.(required & pos ~rev:true 0 (some string) None & info [] ~docv ~doc)
+
+let cmd =
+  let doc = "Copy files" in
+  let man_xrefs =
+    [ `Tool "mv"; `Tool "scp"; `Page ("umask", 2); `Page ("symlink", 7) ]
+  in
+  let man =
+    [ `S Manpage.s_bugs;
+      `P "Email them to <bugs@example.org>."; ]
+  in
+  let info = Cmd.info "cp" ~version:"v1.2.0" ~doc ~man ~man_xrefs in
+  Cmd.v info Term.(ret (const cp $ verbose $ recurse $ force $ srcs $ dest))
+
+
+let main () = exit (Cmd.eval cmd)
+let () = main ()

A tail command

We define the command line interface of a tail command with the synopsis:

tail [OPTION]… [FILE]…

The --lines option whose value specifies the number of last lines to print has a special syntax where a + prefix indicates to start printing from that line number. In the program this is represented by the loc type. We define a custom loc_arg argument converter for this option.

The --follow option has an optional enumerated value. The argument converter follow, created with Cmdliner.Arg.enum parses the option value into the enumeration. By using Cmdliner.Arg.some and the ~vopt argument of Cmdliner.Arg.opt, the term corresponding to the option --follow evaluates to None if --follow is absent from the command line, to Some Descriptor if present but without a value and to Some v if present with a value v specified.

(* Implementation of the command, we just print the args. *)
+
+type loc = bool * int
+type verb = Verbose | Quiet
+type follow = Name | Descriptor
+
+let str = Printf.sprintf
+let opt_str sv = function None -> "None" | Some v -> str "Some(%s)" (sv v)
+let loc_str (rev, k) = if rev then str "%d" k else str "+%d" k
+let follow_str = function Name -> "name" | Descriptor -> "descriptor"
+let verb_str = function Verbose -> "verbose" | Quiet -> "quiet"
+
+let tail lines follow verb pid files =
+  Printf.printf
+    "lines = %s\nfollow = %s\nverb = %s\npid = %s\nfiles = %s\n"
+    (loc_str lines) (opt_str follow_str follow) (verb_str verb)
+    (opt_str string_of_int pid) (String.concat ", " files)
+
+(* Command line interface *)
+
+open Cmdliner
+
+let loc_arg =
+  let parse s =
+    try
+      if s <> "" && s.[0] <> '+'
+      then Ok (true, int_of_string s)
+      else Ok (false, int_of_string (String.sub s 1 (String.length s - 1)))
+    with Failure _ -> Error (`Msg "unable to parse integer")
+  in
+  let print ppf p = Format.fprintf ppf "%s" (loc_str p) in
+  Arg.conv ~docv:"N" (parse, print)
+
+let lines =
+  let doc = "Output the last $(docv) lines or use $(i,+)$(docv) to start \
+             output after the $(i,N)-1th line."
+  in
+  Arg.(value & opt loc_arg (true, 10) & info ["n"; "lines"] ~docv:"N" ~doc)
+
+let follow =
+  let doc = "Output appended data as the file grows. $(docv) specifies how \
+             the file should be tracked, by its $(b,name) or by its \
+             $(b,descriptor)."
+  in
+  let follow = Arg.enum ["name", Name; "descriptor", Descriptor] in
+  Arg.(value & opt (some follow) ~vopt:(Some Descriptor) None &
+       info ["f"; "follow"] ~docv:"ID" ~doc)
+
+let verb =
+  let quiet =
+    let doc = "Never output headers giving file names." in
+    Quiet, Arg.info ["q"; "quiet"; "silent"] ~doc
+  in
+  let verbose =
+    let doc = "Always output headers giving file names." in
+    Verbose, Arg.info ["v"; "verbose"] ~doc
+  in
+  Arg.(last & vflag_all [Quiet] [quiet; verbose])
+
+let pid =
+  let doc = "With -f, terminate after process $(docv) dies." in
+  Arg.(value & opt (some int) None & info ["pid"] ~docv:"PID" ~doc)
+
+let files = Arg.(value & (pos_all non_dir_file []) & info [] ~docv:"FILE")
+
+let cmd =
+  let doc = "Display the last part of a file" in
+  let man = [
+    `S Manpage.s_description;
+    `P "$(tname) prints the last lines of each $(i,FILE) to standard output. If
+        no file is specified reads standard input. The number of printed
+        lines can be  specified with the $(b,-n) option.";
+    `S Manpage.s_bugs;
+    `P "Report them to <bugs@example.org>.";
+    `S Manpage.s_see_also;
+    `P "$(b,cat)(1), $(b,head)(1)" ]
+  in
+  let info = Cmd.info "tail" ~version:"v1.2.0" ~doc ~man in
+  Cmd.v info Term.(const tail $ lines $ follow $ verb $ pid $ files)
+
+
+let main () = exit (Cmd.eval cmd)
+let () = main ()

A darcs command

We define the command line interface of a darcs command with the synopsis:

darcs [COMMAND] …

The --debug, -q, -v and --prehook options are available in each command. To avoid having to pass them individually to each command we gather them in a record of type copts. By lifting the record constructor copts into the term copts_t we now have a term that we can pass to the commands to stand for an argument of type copts. These options are documented in a section called COMMON +OPTIONS, since we also want to put --help and --version in this section, the term information of commands makes a judicious use of the sdocs parameter of Cmdliner.Term.info.

The help command shows help about commands or other topics. The help shown for commands is generated by Cmdliner by making an appropriate use of Cmdliner.Term.ret on the lifted help function.

If the program is invoked without a command we just want to show the help of the program as printed by Cmdliner with --help. This is done by the default_cmd term.

(* Implementations, just print the args. *)
+
+type verb = Normal | Quiet | Verbose
+type copts = { debug : bool; verb : verb; prehook : string option }
+
+let str = Printf.sprintf
+let opt_str sv = function None -> "None" | Some v -> str "Some(%s)" (sv v)
+let opt_str_str = opt_str (fun s -> s)
+let verb_str = function
+  | Normal -> "normal" | Quiet -> "quiet" | Verbose -> "verbose"
+
+let pr_copts oc copts = Printf.fprintf oc
+    "debug = %B\nverbosity = %s\nprehook = %s\n"
+    copts.debug (verb_str copts.verb) (opt_str_str copts.prehook)
+
+let initialize copts repodir = Printf.printf
+    "%arepodir = %s\n" pr_copts copts repodir
+
+let record copts name email all ask_deps files = Printf.printf
+    "%aname = %s\nemail = %s\nall = %B\nask-deps = %B\nfiles = %s\n"
+    pr_copts copts (opt_str_str name) (opt_str_str email) all ask_deps
+    (String.concat ", " files)
+
+let help copts man_format cmds topic = match topic with
+| None -> `Help (`Pager, None) (* help about the program. *)
+| Some topic ->
+    let topics = "topics" :: "patterns" :: "environment" :: cmds in
+    let conv, _ = Cmdliner.Arg.enum (List.rev_map (fun s -> (s, s)) topics) in
+    match conv topic with
+    | `Error e -> `Error (false, e)
+    | `Ok t when t = "topics" -> List.iter print_endline topics; `Ok ()
+    | `Ok t when List.mem t cmds -> `Help (man_format, Some t)
+    | `Ok t ->
+        let page = (topic, 7, "", "", ""), [`S topic; `P "Say something";] in
+        `Ok (Cmdliner.Manpage.print man_format Format.std_formatter page)
+
+open Cmdliner
+
+(* Help sections common to all commands *)
+
+let help_secs = [
+ `S Manpage.s_common_options;
+ `P "These options are common to all commands.";
+ `S "MORE HELP";
+ `P "Use $(mname) $(i,COMMAND) --help for help on a single command.";`Noblank;
+ `P "Use $(mname) $(b,help patterns) for help on patch matching."; `Noblank;
+ `P "Use $(mname) $(b,help environment) for help on environment variables.";
+ `S Manpage.s_bugs; `P "Check bug reports at http://bugs.example.org.";]
+
+(* Options common to all commands *)
+
+let copts debug verb prehook = { debug; verb; prehook }
+let copts_t =
+  let docs = Manpage.s_common_options in
+  let debug =
+    let doc = "Give only debug output." in
+    Arg.(value & flag & info ["debug"] ~docs ~doc)
+  in
+  let verb =
+    let doc = "Suppress informational output." in
+    let quiet = Quiet, Arg.info ["q"; "quiet"] ~docs ~doc in
+    let doc = "Give verbose output." in
+    let verbose = Verbose, Arg.info ["v"; "verbose"] ~docs ~doc in
+    Arg.(last & vflag_all [Normal] [quiet; verbose])
+  in
+  let prehook =
+    let doc = "Specify command to run before this $(mname) command." in
+    Arg.(value & opt (some string) None & info ["prehook"] ~docs ~doc)
+  in
+  Term.(const copts $ debug $ verb $ prehook)
+
+(* Commands *)
+
+let sdocs = Manpage.s_common_options
+
+let initialize_cmd =
+  let repodir =
+    let doc = "Run the program in repository directory $(docv)." in
+    Arg.(value & opt file Filename.current_dir_name & info ["repodir"]
+           ~docv:"DIR" ~doc)
+  in
+  let doc = "make the current directory a repository" in
+  let man = [
+    `S Manpage.s_description;
+    `P "Turns the current directory into a Darcs repository. Any
+       existing files and subdirectories become …";
+    `Blocks help_secs; ]
+  in
+  let info = Cmd.info "initialize" ~doc ~sdocs ~man in
+  Cmd.v info Term.(const initialize $ copts_t $ repodir)
+
+let record_cmd =
+  let pname =
+    let doc = "Name of the patch." in
+    Arg.(value & opt (some string) None & info ["m"; "patch-name"] ~docv:"NAME"
+           ~doc)
+  in
+  let author =
+    let doc = "Specifies the author's identity." in
+    Arg.(value & opt (some string) None & info ["A"; "author"] ~docv:"EMAIL"
+           ~doc)
+  in
+  let all =
+    let doc = "Answer yes to all patches." in
+    Arg.(value & flag & info ["a"; "all"] ~doc)
+  in
+  let ask_deps =
+    let doc = "Ask for extra dependencies." in
+    Arg.(value & flag & info ["ask-deps"] ~doc)
+  in
+  let files = Arg.(value & (pos_all file) [] & info [] ~docv:"FILE or DIR") in
+  let doc = "create a patch from unrecorded changes" in
+  let man =
+    [`S Manpage.s_description;
+     `P "Creates a patch from changes in the working tree. If you specify
+         a set of files …";
+     `Blocks help_secs; ]
+  in
+  let info = Cmd.info "record" ~doc ~sdocs ~man in
+  Cmd.v info
+    Term.(const record $ copts_t $ pname $ author $ all $ ask_deps $ files)
+
+let help_cmd =
+  let topic =
+    let doc = "The topic to get help on. $(b,topics) lists the topics." in
+    Arg.(value & pos 0 (some string) None & info [] ~docv:"TOPIC" ~doc)
+  in
+  let doc = "display help about darcs and darcs commands" in
+  let man =
+    [`S Manpage.s_description;
+     `P "Prints help about darcs commands and other subjects…";
+     `Blocks help_secs; ]
+  in
+  let info = Cmd.info "help" ~doc ~man in
+  Cmd.v info
+    Term.(ret (const help $ copts_t $ Arg.man_format $ Term.choice_names $
+               topic))
+
+let main_cmd =
+  let doc = "a revision control system" in
+  let man = help_secs in
+  let info = Cmd.info "darcs" ~version:"v1.2.0" ~doc ~sdocs ~man in
+  let default = Term.(ret (const (fun _ -> `Help (`Pager, None)) $ copts_t)) in
+  Cmd.group info ~default [initialize_cmd; record_cmd; help_cmd]
+
+let () = exit (Cmd.eval main_cmd)
diff --git a/cmdliner/index.html b/cmdliner/index.html new file mode 100644 index 00000000..e2dc3fe0 --- /dev/null +++ b/cmdliner/index.html @@ -0,0 +1,2 @@ + +index (cmdliner.index)

Package cmdliner

Cmdliner provides a simple and compositional mechanism to convert command line arguments to OCaml values and pass them to your functions.

The library automatically handles syntax errors, help messages and UNIX man page generation. It supports programs with single or multiple commands (like git) and respect most of the POSIX and GNU conventions.

Manuals

The following manuals are available.

  • The tutorial gets you through the steps to write your first command line interface with Cmdliner.
  • The Command line interface manual describes how command lines and environment variables are parsed by Cmdliner.
  • Tool man pages describes how Cmdliner generates man pages for your tools and how you can format them.
  • The examples page has a few annoted examples that show to express the command line interface of a few classic tools with Cmdliner

API

  • Cmdliner Declarative definition of command line interfaces.

Package info

changes-files
license-files
readme-files
diff --git a/cmdliner/tool_man.html b/cmdliner/tool_man.html new file mode 100644 index 00000000..2eece306 --- /dev/null +++ b/cmdliner/tool_man.html @@ -0,0 +1,2 @@ + +tool_man (cmdliner.tool_man)

Tool man pages

Manual

Man page sections for a command are printed in the order specified by manual as given to Cmdliner.Cmd.info. Unless specified explicitly in the command's manual the following sections are automatically created and populated for you:

The various doc documentation strings specified by the command's term arguments get inserted at the end of the documentation section they respectively mention in their docs argument:

  1. For commands, see Cmdliner.Cmd.info.
  2. For positional arguments, see Cmdliner.Arg.info. Those are listed iff both the docv and doc string is specified by Cmdliner.Arg.info.
  3. For optional arguments, see Cmdliner.Arg.info.
  4. For exit statuses, see Cmdliner.Cmd.Exit.info.
  5. For environment variables, see Cmdliner.Arg.env_var and Cmdliner.Cmd.Env.info.

If a docs section name is mentioned and does not exist in the command's manual, an empty section is created for it, after which the doc strings are inserted, possibly prefixed by boilerplate text (e.g. for Cmdliner.Manpage.s_environment and Cmdliner.Manpage.s_exit_status).

If the created section is:

  • standard, it is inserted at the right place in the order specified here, but after a possible non-standard section explicitly specified by the command's manual since the latter get the order number of the last previously specified standard section or the order of Cmdliner.Manpage.s_synopsis if there is no such section.
  • non-standard, it is inserted before the Cmdliner.Manpage.s_commands section or the first subsequent existing standard section if it doesn't exist. Taking advantage of this behaviour is discouraged, you should declare manually your non standard section in the command's manual page.

Finally note that the header of empty sections are dropped from the output. This allows you to share section placements among many commands and render them only if something actually gets inserted in it.

Documentation markup language

Manpage blocks and doc strings support the following markup language.

  • Markup directives $(i,text) and $(b,text), where text is raw text respectively rendered in italics and bold.
  • Outside markup directives, context dependent variables of the form $(var) are substituted by marked up data. For example in a term's man page $(tname) is substituted by the term name in bold.
  • Characters $, (, ) and \ can respectively be escaped by \$, \(, \) and \\ (in OCaml strings this will be "\\$", "\\(", "\\)", "\\\\"). Escaping $ and \ is mandatory everywhere. Escaping ) is mandatory only in markup directives. Escaping ( is only here for your symmetric pleasure. Any other sequence of characters starting with a \ is an illegal character sequence.
  • Referring to unknown markup directives or variables will generate errors on standard error during documentation generation.
diff --git a/cmdliner/tutorial.html b/cmdliner/tutorial.html new file mode 100644 index 00000000..567a1c72 --- /dev/null +++ b/cmdliner/tutorial.html @@ -0,0 +1,67 @@ + +tutorial (cmdliner.tutorial)

Tutorial

Getting started

With Cmdliner your tool's main function evaluates a command.

A command is a value of type Cmdliner.Cmd.t which gathers a command name and a term of type Cmdliner.Term.t. A term is an expression to be evaluated. The type parameter of the term (and the command) indicates the type of the result of the evaluation.

One way to create terms is by lifting regular OCaml values with Cmdliner.Term.const. Terms can be applied to terms evaluating to functional values with Cmdliner.Term.($).

For example, in a revolt.ml file, for the function:

let revolt () = print_endline "Revolt!"

the term :

open Cmdliner
+
+let revolt_t = Term.(const revolt $ const ())

is a term that evaluates to the result (and effect) of the revolt function. This term can be attached to a command:

let cmd = Cmd.v (Cmd.info "revolt") revolt_t

and evaluated with Cmdliner.Cmd.eval:

let () = exit (Cmd.eval cmd)

This defines a command line tool named "revolt" (this name will be used in error reporting and documentation generation), without command line arguments, that just prints "Revolt!" on stdout.

> ocamlfind ocamlopt -linkpkg -package cmdliner -o revolt revolt.ml
+> ./revolt
+Revolt!

The combinators in the Cmdliner.Arg module allow to extract command line arguments as terms. These terms can then be applied to lifted OCaml functions to be evaluated.

Terms corresponding to command line argument data that are part of a term evaluation implicitly define a command line syntax. We show this on an concrete example.

In a chorus.ml file, consider the chorus function that prints repeatedly a given message :

let chorus count msg = for i = 1 to count do print_endline msg done

we want to make it available from the command line with the synopsis:

chorus [-c COUNT | --count=COUNT] [MSG]

where COUNT defaults to 10 and MSG defaults to "Revolt!". We first define a term corresponding to the --count option:

let count =
+  let doc = "Repeat the message $(docv) times." in
+  Arg.(value & opt int 10 & info ["c"; "count"] ~docv:"COUNT" ~doc)

This says that count is a term that evaluates to the value of an optional argument of type int that defaults to 10 if unspecified and whose option name is either -c or --count. The arguments doc and docv are used to generate the option's man page information.

The term for the positional argument MSG is:

let msg =
+  let env =
+    let doc = "Overrides the default message to print." in
+    Cmd.Env.info "CHORUS_MSG" ~doc
+  in
+  let doc = "The message to print." in
+  Arg.(value & pos 0 string "Revolt!" & info [] ~env ~docv:"MSG" ~doc)

which says that msg is a term whose value is the positional argument at index 0 of type string and defaults to "Revolt!" or the value of the environment variable CHORUS_MSG if the argument is unspecified on the command line. Here again doc and docv are used for the man page information.

The term for executing chorus with these command line arguments is :

let chorus_t = Term.(const chorus $ count $ msg)

We are now ready to define the main function of our tool:

let cmd =
+  let doc = "print a customizable message repeatedly" in
+  let man = [
+    `S Manpage.s_bugs;
+    `P "Email bug reports to <bugs@example.org>." ]
+  in
+  let info = Cmd.info "chorus" ~version:"%‌%VERSION%%" ~doc ~man in
+  Cmd.v info chorus_t
+
+let main () = exit (Cmd.eval cmd)
+let () = main ()

The info value created with Cmdliner.Cmd.info gives more information about the term we execute and is used to generate the tool's man page. Since we provided a ~version string, the tool will automatically respond to the --version option by printing this string.

A tool using Cmdliner.Cmd.eval always responds to the --help option by showing the tool's man page generated using the information you provided with Cmdliner.Cmd.info and Cmdliner.Arg.info. Here is the output generated by our example:

> ocamlfind ocamlopt -linkpkg -package cmdliner -o chorus chorus.ml
+> ./chorus --help
+NAME
+       chorus - Print a customizable message repeatedly
+
+SYNOPSIS
+       chorus [--count=COUNT] [OPTION]… [MSG]
+
+ARGUMENTS
+       MSG (absent=Revolt! or CHORUS_MSG env)
+           The message to print.
+
+OPTIONS
+       -c COUNT, --count=COUNT (absent=10)
+           Repeat the message COUNT times.
+
+COMMON OPTIONS
+       --help[=FMT] (default=auto)
+           Show this help in format FMT. The value FMT must be one of auto,
+           pager, groff or plain. With auto, the format is pager or plain
+           whenever the TERM env var is dumb or undefined.
+
+       --version
+           Show version information.
+
+EXIT STATUS
+       chorus exits with the following status:
+
+       0   on success.
+
+       123 on indiscriminate errors reported on standard error.
+
+       124 on command line parsing errors.
+
+       125 on unexpected internal errors (bugs).
+
+ENVIRONMENT
+       These environment variables affect the execution of chorus:
+
+       CHORUS_MSG
+           Overrides the default message to print.
+
+BUGS
+       Email bug reports to <bugs@example.org>.

If a pager is available, this output is written to a pager. This help is also available in plain text or in the groff man page format by invoking the program with the option --help=plain or --help=groff.

For examples of more complex command line definitions look and run the examples.

Sub commands

Cmdliner also provides support for programs like git that have sub commands each with their own command line syntax and manual:

tool [COMMAND]… [OPTION]… ARG…

These sub commands are defined by grouping them under a parent command via the Cmdliner.Cmd.group function.

diff --git a/dev/highlight.pack.js b/dev/highlight.pack.js deleted file mode 100644 index 40370e82..00000000 --- a/dev/highlight.pack.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! highlight.js v9.12.0 | BSD3 License | git.io/hljslicense */ -!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(e){function n(e){return e.replace(/&/g,"&").replace(//g,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0===t.index}function a(e){return k.test(e)}function i(e){var n,t,r,i,o=e.className+" ";if(o+=e.parentNode?e.parentNode.className:"",t=B.exec(o))return w(t[1])?t[1]:"no-highlight";for(o=o.split(/\s+/),n=0,r=o.length;r>n;n++)if(i=o[n],a(i)||w(i))return i}function o(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3===i.nodeType?a+=i.nodeValue.length:1===i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!==r[0].offset?e[0].offset"}function u(e){s+=""}function c(e){("start"===e.event?o:u)(e.node)}for(var l=0,s="",f=[];e.length||r.length;){var g=i();if(s+=n(a.substring(l,g[0].offset)),l=g[0].offset,g===e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g===e&&g.length&&g[0].offset===l);f.reverse().forEach(o)}else"start"===g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return s+n(a.substr(l))}function l(e){return e.v&&!e.cached_variants&&(e.cached_variants=e.v.map(function(n){return o(e,{v:null},n)})),e.cached_variants||e.eW&&[o(e)]||[e]}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var o={},u=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");o[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?u("keyword",a.k):x(a.k).forEach(function(e){u(e,a.k[e])}),a.k=o}a.lR=t(a.l||/\w+/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),null==a.r&&(a.r=1),a.c||(a.c=[]),a.c=Array.prototype.concat.apply([],a.c.map(function(e){return l("self"===e?a:e)})),a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var c=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=c.length?t(c.join("|"),!0):{exec:function(){return null}}}}r(e)}function f(e,t,a,i){function o(e,n){var t,a;for(t=0,a=n.c.length;a>t;t++)if(r(n.c[t].bR,e))return n.c[t]}function u(e,n){if(r(e.eR,n)){for(;e.endsParent&&e.parent;)e=e.parent;return e}return e.eW?u(e.parent,n):void 0}function c(e,n){return!a&&r(n.iR,e)}function l(e,n){var t=N.cI?n[0].toLowerCase():n[0];return e.k.hasOwnProperty(t)&&e.k[t]}function p(e,n,t,r){var a=r?"":I.classPrefix,i='',i+n+o}function h(){var e,t,r,a;if(!E.k)return n(k);for(a="",t=0,E.lR.lastIndex=0,r=E.lR.exec(k);r;)a+=n(k.substring(t,r.index)),e=l(E,r),e?(B+=e[1],a+=p(e[0],n(r[0]))):a+=n(r[0]),t=E.lR.lastIndex,r=E.lR.exec(k);return a+n(k.substr(t))}function d(){var e="string"==typeof E.sL;if(e&&!y[E.sL])return n(k);var t=e?f(E.sL,k,!0,x[E.sL]):g(k,E.sL.length?E.sL:void 0);return E.r>0&&(B+=t.r),e&&(x[E.sL]=t.top),p(t.language,t.value,!1,!0)}function b(){L+=null!=E.sL?d():h(),k=""}function v(e){L+=e.cN?p(e.cN,"",!0):"",E=Object.create(e,{parent:{value:E}})}function m(e,n){if(k+=e,null==n)return b(),0;var t=o(n,E);if(t)return t.skip?k+=n:(t.eB&&(k+=n),b(),t.rB||t.eB||(k=n)),v(t,n),t.rB?0:n.length;var r=u(E,n);if(r){var a=E;a.skip?k+=n:(a.rE||a.eE||(k+=n),b(),a.eE&&(k=n));do E.cN&&(L+=C),E.skip||(B+=E.r),E=E.parent;while(E!==r.parent);return r.starts&&v(r.starts,""),a.rE?0:n.length}if(c(n,E))throw new Error('Illegal lexeme "'+n+'" for mode "'+(E.cN||"")+'"');return k+=n,n.length||1}var N=w(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var R,E=i||N,x={},L="";for(R=E;R!==N;R=R.parent)R.cN&&(L=p(R.cN,"",!0)+L);var k="",B=0;try{for(var M,j,O=0;;){if(E.t.lastIndex=O,M=E.t.exec(t),!M)break;j=m(t.substring(O,M.index),M[0]),O=M.index+j}for(m(t.substr(O)),R=E;R.parent;R=R.parent)R.cN&&(L+=C);return{r:B,value:L,language:e,top:E}}catch(T){if(T.message&&-1!==T.message.indexOf("Illegal"))return{r:0,value:n(t)};throw T}}function g(e,t){t=t||I.languages||x(y);var r={r:0,value:n(e)},a=r;return t.filter(w).forEach(function(n){var t=f(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}),a.language&&(r.second_best=a),r}function p(e){return I.tabReplace||I.useBR?e.replace(M,function(e,n){return I.useBR&&"\n"===e?"
":I.tabReplace?n.replace(/\t/g,I.tabReplace):""}):e}function h(e,n,t){var r=n?L[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function d(e){var n,t,r,o,l,s=i(e);a(s)||(I.useBR?(n=document.createElementNS("http://www.w3.org/1999/xhtml","div"),n.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):n=e,l=n.textContent,r=s?f(s,l,!0):g(l),t=u(n),t.length&&(o=document.createElementNS("http://www.w3.org/1999/xhtml","div"),o.innerHTML=r.value,r.value=c(t,u(o),l)),r.value=p(r.value),e.innerHTML=r.value,e.className=h(e.className,s,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function b(e){I=o(I,e)}function v(){if(!v.called){v.called=!0;var e=document.querySelectorAll("pre code");E.forEach.call(e,d)}}function m(){addEventListener("DOMContentLoaded",v,!1),addEventListener("load",v,!1)}function N(n,t){var r=y[n]=t(e);r.aliases&&r.aliases.forEach(function(e){L[e]=n})}function R(){return x(y)}function w(e){return e=(e||"").toLowerCase(),y[e]||y[L[e]]}var E=[],x=Object.keys,y={},L={},k=/^(no-?highlight|plain|text)$/i,B=/\blang(?:uage)?-([\w-]+)\b/i,M=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,C="
",I={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0};return e.highlight=f,e.highlightAuto=g,e.fixMarkup=p,e.highlightBlock=d,e.configure=b,e.initHighlighting=v,e.initHighlightingOnLoad=m,e.registerLanguage=N,e.listLanguages=R,e.getLanguage=w,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e.METHOD_GUARD={b:"\\.\\s*"+e.UIR,r:0},e});hljs.registerLanguage("ocaml",function(e){return{aliases:["ml"],k:{keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value",built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref",literal:"true false"},i:/\/\/|>>/,l:"[a-z_]\\w*!?",c:[{cN:"literal",b:"\\[(\\|\\|)?\\]|\\(\\)",r:0},e.C("\\(\\*","\\*\\)",{c:["self"]}),{cN:"symbol",b:"'[A-Za-z_](?!')[\\w']*"},{cN:"type",b:"`[A-Z][\\w']*"},{cN:"type",b:"\\b[A-Z][\\w']*",r:0},{b:"[a-z_]\\w*'[\\w']*",r:0},e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{i:null}),{cN:"number",b:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",r:0},{b:/[-=]>/}]}}); \ No newline at end of file diff --git a/dev/index.html b/dev/index.html deleted file mode 100644 index c433ae86..00000000 --- a/dev/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - index - - - - - -
-
-

OCaml package documentation

-
    -
  1. linol 0.1
  2. -
  3. linol-lwt 0.1
  4. -
-
-
- - \ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/Jsonrpc2/IO/index.html b/dev/linol-lwt/Linol_lwt/Jsonrpc2/IO/index.html deleted file mode 100644 index 960621f9..00000000 --- a/dev/linol-lwt/Linol_lwt/Jsonrpc2/IO/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -IO (linol-lwt.Linol_lwt.Jsonrpc2.IO)

Module Jsonrpc2.IO

type 'a t = 'a Task.m
val return : 'a -> 'a t
val failwith : string -> 'a t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
type in_channel = Lwt_io.input Lwt_io.channel
type out_channel = Lwt_io.output Lwt_io.channel
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/Jsonrpc2/class-base_server/index.html b/dev/linol-lwt/Linol_lwt/Jsonrpc2/class-base_server/index.html deleted file mode 100644 index 6405165c..00000000 --- a/dev/linol-lwt/Linol_lwt/Jsonrpc2/class-base_server/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -base_server (linol-lwt.Linol_lwt.Jsonrpc2.base_server)

Class Jsonrpc2.base_server

method must_quit : bool
method virtual on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t
method virtual on_request : a. 'a Lsp.Client_request.t -> 'a IO.t
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/Jsonrpc2/class-notify_back/index.html b/dev/linol-lwt/Linol_lwt/Jsonrpc2/class-notify_back/index.html deleted file mode 100644 index aead5a7e..00000000 --- a/dev/linol-lwt/Linol_lwt/Jsonrpc2/class-notify_back/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -notify_back (linol-lwt.Linol_lwt.Jsonrpc2.notify_back)

Class Jsonrpc2.notify_back

method send_diagnostic : Lsp.Types.Diagnostic.t list -> unit IO.t
method send_log_msg : type_:Lsp__Types.MessageType.t -> string -> unit IO.t
method send_notification : Lsp.Server_notification.t -> unit IO.t
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/Jsonrpc2/class-server/index.html b/dev/linol-lwt/Linol_lwt/Jsonrpc2/class-server/index.html deleted file mode 100644 index 15549c57..00000000 --- a/dev/linol-lwt/Linol_lwt/Jsonrpc2/class-server/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -server (linol-lwt.Linol_lwt.Jsonrpc2.server)

Class Jsonrpc2.server

val docs : (Lsp.Types.DocumentUri.t, doc_state) Stdlib.Hashtbl.t
val mutable _quit : bool
method config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t
method find_doc : Lsp.Types.DocumentUri.t -> doc_state option
method must_quit : bool
method virtual on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t
method virtual on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t
method virtual on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t
method on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t
method on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t
method on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t
method on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t
method on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t
method on_request : a. 'a Lsp.Client_request.t -> 'a IO.t
method on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/Jsonrpc2/index.html b/dev/linol-lwt/Linol_lwt/Jsonrpc2/index.html deleted file mode 100644 index 9125ab02..00000000 --- a/dev/linol-lwt/Linol_lwt/Jsonrpc2/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Jsonrpc2 (linol-lwt.Linol_lwt.Jsonrpc2)

Module Linol_lwt.Jsonrpc2

module IO : Linol.IO with type 'a t = 'a Task.m and type in_channel = Lwt_io.input Lwt_io.channel and type out_channel = Lwt_io.output Lwt_io.channel
type json = Yojson.Safe.t
type t

A jsonrpc2 connection.

include module type of sig ... end
module Position = Lsp.Types.Position
module Range = Lsp.Types.Range
class virtual base_server : object ... end
class notify_back : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> ?⁠version:int -> uri:Lsp.Types.DocumentUri.t -> unit -> object ... end
type doc_state = Linol.Make(IO).doc_state = {
uri : Lsp.Types.DocumentUri.t;
languageId : string;
version : int;
content : string;
}
class virtual server : object ... end
val create : ic:IO.in_channel -> oc:IO.out_channel -> server -> t

Create a connection from the pair of channels

val create_stdio : server -> t
val run : t -> unit Task.t -> unit Task.m

Listen for incoming messages and responses

\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/Task/Infix/index.html b/dev/linol-lwt/Linol_lwt/Task/Infix/index.html deleted file mode 100644 index 89d7c412..00000000 --- a/dev/linol-lwt/Linol_lwt/Task/Infix/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Infix (linol-lwt.Linol_lwt.Task.Infix)

Module Task.Infix

val let+ : 'a m -> ('a -> 'b) -> 'b m
val let* : 'a m -> ('a -> 'b m) -> 'b m
val (>|=) : 'a m -> ('a -> 'b) -> 'b m
val (>>=) : 'a m -> ('a -> 'b m) -> 'b m
val and+ : 'a m -> 'b m -> ('a * 'b) m
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/Task/Wrapped_error/index.html b/dev/linol-lwt/Linol_lwt/Task/Wrapped_error/index.html deleted file mode 100644 index bd535bf5..00000000 --- a/dev/linol-lwt/Linol_lwt/Task/Wrapped_error/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Wrapped_error (linol-lwt.Linol_lwt.Task.Wrapped_error)

Module Task.Wrapped_error

type 'a task = 'a t
type t =
| E : {
task : 'a task;
e : exn;
} -> t
exception Wrapped of t

An exception caught and re-launched from a task

val pp : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/Task/index.html b/dev/linol-lwt/Linol_lwt/Task/index.html deleted file mode 100644 index ba45eb12..00000000 --- a/dev/linol-lwt/Linol_lwt/Task/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Task (linol-lwt.Linol_lwt.Task)

Module Linol_lwt.Task

Tasks

Tasks built on top of Lwt, for cooperative multi-threading.

type 'a t

A task

type 'a m = 'a Lwt.t

Computation within the task

type cancel
val return : 'a -> 'a m
val start : ?⁠descr:string -> ?⁠cancel:cancel -> ('a t -> 'a m) -> 'a t
val descr : _ t -> string option
val run : 'a t -> ('a, exn) Stdlib.result
val run_sub : parent:_ t -> ?⁠descr:string -> ?⁠cancel:cancel -> ('a t -> 'a m) -> ('a, exn) Stdlib.result m
module Wrapped_error : sig ... end
val unwrap : ('a, exn) Stdlib.result -> 'a m
val is_cancelled : _ t -> bool
val cancel : _ t -> unit
val pause : _ t -> unit m
val wait_all : (unit, exn) Stdlib.result m list -> (unit, exn) Stdlib.result m
module Infix : sig ... end
include module type of Infix
val let+ : 'a m -> ('a -> 'b) -> 'b m
val let* : 'a m -> ('a -> 'b m) -> 'b m
val (>|=) : 'a m -> ('a -> 'b) -> 'b m
val (>>=) : 'a m -> ('a -> 'b m) -> 'b m
val and+ : 'a m -> 'b m -> ('a * 'b) m
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/index.html b/dev/linol-lwt/Linol_lwt/index.html deleted file mode 100644 index 305121f6..00000000 --- a/dev/linol-lwt/Linol_lwt/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Linol_lwt (linol-lwt.Linol_lwt)

Module Linol_lwt

module type IO = Linol.IO
module Make = Linol.Make
module Jsonrpc2 : sig ... end
module Task : sig ... end
include Lsp.Types
module MarkedString = Lsp__Types.MarkedString
module DeleteFileOptions = Lsp__Types.DeleteFileOptions
module DocumentUri = Lsp__Types.DocumentUri
module DeleteFile = Lsp__Types.DeleteFile
module RenameFileOptions = Lsp__Types.RenameFileOptions
module RenameFile = Lsp__Types.RenameFile
module CreateFileOptions = Lsp__Types.CreateFileOptions
module CreateFile = Lsp__Types.CreateFile
module Position = Lsp__Types.Position
module Range = Lsp__Types.Range
module TextEdit = Lsp__Types.TextEdit
module TextDocumentIdentifier = Lsp__Types.TextDocumentIdentifier
module VersionedTextDocumentIdentifier = Lsp__Types.VersionedTextDocumentIdentifier
module TextDocumentEdit = Lsp__Types.TextDocumentEdit
module WorkspaceEdit = Lsp__Types.WorkspaceEdit
module ApplyWorkspaceEditParams = Lsp__Types.ApplyWorkspaceEditParams
module ApplyWorkspaceEditResponse = Lsp__Types.ApplyWorkspaceEditResponse
module CancelParams = Lsp__Types.CancelParams
module SelectionRangeClientCapabilities = Lsp__Types.SelectionRangeClientCapabilities
module FoldingRangeClientCapabilities = Lsp__Types.FoldingRangeClientCapabilities
module DiagnosticTag = Lsp__Types.DiagnosticTag
module PublishDiagnosticsClientCapabilities = Lsp__Types.PublishDiagnosticsClientCapabilities
module RenameClientCapabilities = Lsp__Types.RenameClientCapabilities
module DocumentOnTypeFormattingClientCapabilities = Lsp__Types.DocumentOnTypeFormattingClientCapabilities
module DocumentRangeFormattingClientCapabilities = Lsp__Types.DocumentRangeFormattingClientCapabilities
module DocumentFormattingClientCapabilities = Lsp__Types.DocumentFormattingClientCapabilities
module DocumentColorClientCapabilities = Lsp__Types.DocumentColorClientCapabilities
module DocumentLinkClientCapabilities = Lsp__Types.DocumentLinkClientCapabilities
module CodeLensClientCapabilities = Lsp__Types.CodeLensClientCapabilities
module CodeActionKind = Lsp__Types.CodeActionKind
module CodeActionClientCapabilities = Lsp__Types.CodeActionClientCapabilities
module SymbolKind = Lsp__Types.SymbolKind
module DocumentSymbolClientCapabilities = Lsp__Types.DocumentSymbolClientCapabilities
module DocumentHighlightClientCapabilities = Lsp__Types.DocumentHighlightClientCapabilities
module ReferenceClientCapabilities = Lsp__Types.ReferenceClientCapabilities
module ImplementationClientCapabilities = Lsp__Types.ImplementationClientCapabilities
module TypeDefinitionClientCapabilities = Lsp__Types.TypeDefinitionClientCapabilities
module DefinitionClientCapabilities = Lsp__Types.DefinitionClientCapabilities
module DeclarationClientCapabilities = Lsp__Types.DeclarationClientCapabilities
module MarkupKind = Lsp__Types.MarkupKind
module SignatureHelpClientCapabilities = Lsp__Types.SignatureHelpClientCapabilities
module HoverClientCapabilities = Lsp__Types.HoverClientCapabilities
module CompletionItemKind = Lsp__Types.CompletionItemKind
module CompletionItemTag = Lsp__Types.CompletionItemTag
module CompletionClientCapabilities = Lsp__Types.CompletionClientCapabilities
module TextDocumentSyncClientCapabilities = Lsp__Types.TextDocumentSyncClientCapabilities
module TextDocumentClientCapabilities = Lsp__Types.TextDocumentClientCapabilities
module ExecuteCommandClientCapabilities = Lsp__Types.ExecuteCommandClientCapabilities
module WorkspaceSymbolClientCapabilities = Lsp__Types.WorkspaceSymbolClientCapabilities
module DidChangeWatchedFilesClientCapabilities = Lsp__Types.DidChangeWatchedFilesClientCapabilities
module DidChangeConfigurationClientCapabilities = Lsp__Types.DidChangeConfigurationClientCapabilities
module FailureHandlingKind = Lsp__Types.FailureHandlingKind
module ResourceOperationKind = Lsp__Types.ResourceOperationKind
module WorkspaceEditClientCapabilities = Lsp__Types.WorkspaceEditClientCapabilities
module ClientCapabilities = Lsp__Types.ClientCapabilities
module Command = Lsp__Types.Command
module Location = Lsp__Types.Location
module DiagnosticRelatedInformation = Lsp__Types.DiagnosticRelatedInformation
module DiagnosticSeverity = Lsp__Types.DiagnosticSeverity
module Diagnostic = Lsp__Types.Diagnostic
module CodeAction = Lsp__Types.CodeAction
module CodeActionContext = Lsp__Types.CodeActionContext
module WorkDoneProgressOptions = Lsp__Types.WorkDoneProgressOptions
module CodeActionOptions = Lsp__Types.CodeActionOptions
module ProgressToken = Lsp__Types.ProgressToken
module PartialResultParams = Lsp__Types.PartialResultParams
module WorkDoneProgressParams = Lsp__Types.WorkDoneProgressParams
module CodeActionParams = Lsp__Types.CodeActionParams
module DocumentFilter = Lsp__Types.DocumentFilter
module DocumentSelector = Lsp__Types.DocumentSelector
module TextDocumentRegistrationOptions = Lsp__Types.TextDocumentRegistrationOptions
module CodeActionRegistrationOptions = Lsp__Types.CodeActionRegistrationOptions
module CodeLens = Lsp__Types.CodeLens
module CodeLensOptions = Lsp__Types.CodeLensOptions
module CodeLensParams = Lsp__Types.CodeLensParams
module CodeLensRegistrationOptions = Lsp__Types.CodeLensRegistrationOptions
module Color = Lsp__Types.Color
module ColorInformation = Lsp__Types.ColorInformation
module ColorPresentation = Lsp__Types.ColorPresentation
module ColorPresentationParams = Lsp__Types.ColorPresentationParams
module CompletionTriggerKind = Lsp__Types.CompletionTriggerKind
module CompletionContext = Lsp__Types.CompletionContext
module InsertTextFormat = Lsp__Types.InsertTextFormat
module MarkupContent = Lsp__Types.MarkupContent
module CompletionItem = Lsp__Types.CompletionItem
module CompletionList = Lsp__Types.CompletionList
module CompletionOptions = Lsp__Types.CompletionOptions
module TextDocumentPositionParams = Lsp__Types.TextDocumentPositionParams
module CompletionParams = Lsp__Types.CompletionParams
module CompletionRegistrationOptions = Lsp__Types.CompletionRegistrationOptions
module ConfigurationItem = Lsp__Types.ConfigurationItem
module ConfigurationParams = Lsp__Types.ConfigurationParams
module DeclarationOptions = Lsp__Types.DeclarationOptions
module DeclarationParams = Lsp__Types.DeclarationParams
module StaticRegistrationOptions = Lsp__Types.StaticRegistrationOptions
module DeclarationRegistrationOptions = Lsp__Types.DeclarationRegistrationOptions
module DefinitionOptions = Lsp__Types.DefinitionOptions
module DefinitionParams = Lsp__Types.DefinitionParams
module DefinitionRegistrationOptions = Lsp__Types.DefinitionRegistrationOptions
module DidChangeConfigurationParams = Lsp__Types.DidChangeConfigurationParams
module TextDocumentContentChangeEvent = Lsp__Types.TextDocumentContentChangeEvent
module DidChangeTextDocumentParams = Lsp__Types.DidChangeTextDocumentParams
module FileEvent = Lsp__Types.FileEvent
module DidChangeWatchedFilesParams = Lsp__Types.DidChangeWatchedFilesParams
module FileSystemWatcher = Lsp__Types.FileSystemWatcher
module DidChangeWatchedFilesRegistrationOptions = Lsp__Types.DidChangeWatchedFilesRegistrationOptions
module WorkspaceFolder = Lsp__Types.WorkspaceFolder
module WorkspaceFoldersChangeEvent = Lsp__Types.WorkspaceFoldersChangeEvent
module DidChangeWorkspaceFoldersParams = Lsp__Types.DidChangeWorkspaceFoldersParams
module DidCloseTextDocumentParams = Lsp__Types.DidCloseTextDocumentParams
module TextDocumentItem = Lsp__Types.TextDocumentItem
module DidOpenTextDocumentParams = Lsp__Types.DidOpenTextDocumentParams
module DidSaveTextDocumentParams = Lsp__Types.DidSaveTextDocumentParams
module DocumentColorOptions = Lsp__Types.DocumentColorOptions
module DocumentColorParams = Lsp__Types.DocumentColorParams
module DocumentColorRegistrationOptions = Lsp__Types.DocumentColorRegistrationOptions
module DocumentFormattingOptions = Lsp__Types.DocumentFormattingOptions
module FormattingOptions = Lsp__Types.FormattingOptions
module DocumentFormattingParams = Lsp__Types.DocumentFormattingParams
module DocumentFormattingRegistrationOptions = Lsp__Types.DocumentFormattingRegistrationOptions
module DocumentHighlightKind = Lsp__Types.DocumentHighlightKind
module DocumentHighlight = Lsp__Types.DocumentHighlight
module DocumentHighlightOptions = Lsp__Types.DocumentHighlightOptions
module DocumentHighlightParams = Lsp__Types.DocumentHighlightParams
module DocumentHighlightRegistrationOptions = Lsp__Types.DocumentHighlightRegistrationOptions
module DocumentLinkOptions = Lsp__Types.DocumentLinkOptions
module DocumentLinkParams = Lsp__Types.DocumentLinkParams
module DocumentLinkRegistrationOptions = Lsp__Types.DocumentLinkRegistrationOptions
module DocumentOnTypeFormattingOptions = Lsp__Types.DocumentOnTypeFormattingOptions
module DocumentOnTypeFormattingParams = Lsp__Types.DocumentOnTypeFormattingParams
module DocumentOnTypeFormattingRegistrationOptions = Lsp__Types.DocumentOnTypeFormattingRegistrationOptions
module DocumentRangeFormattingOptions = Lsp__Types.DocumentRangeFormattingOptions
module DocumentRangeFormattingParams = Lsp__Types.DocumentRangeFormattingParams
module DocumentRangeFormattingRegistrationOptions = Lsp__Types.DocumentRangeFormattingRegistrationOptions
module DocumentSymbol = Lsp__Types.DocumentSymbol
module DocumentSymbolOptions = Lsp__Types.DocumentSymbolOptions
module DocumentSymbolParams = Lsp__Types.DocumentSymbolParams
module DocumentSymbolRegistrationOptions = Lsp__Types.DocumentSymbolRegistrationOptions
module ErrorCodes = Lsp__Types.ErrorCodes
module ExecuteCommandOptions = Lsp__Types.ExecuteCommandOptions
module ExecuteCommandParams = Lsp__Types.ExecuteCommandParams
module ExecuteCommandRegistrationOptions = Lsp__Types.ExecuteCommandRegistrationOptions
module FileChangeType = Lsp__Types.FileChangeType
module FoldingRangeKind = Lsp__Types.FoldingRangeKind
module FoldingRange = Lsp__Types.FoldingRange
module FoldingRangeOptions = Lsp__Types.FoldingRangeOptions
module FoldingRangeParams = Lsp__Types.FoldingRangeParams
module FoldingRangeRegistrationOptions = Lsp__Types.FoldingRangeRegistrationOptions
module Hover = Lsp__Types.Hover
module HoverOptions = Lsp__Types.HoverOptions
module HoverParams = Lsp__Types.HoverParams
module HoverRegistrationOptions = Lsp__Types.HoverRegistrationOptions
module ImplementationOptions = Lsp__Types.ImplementationOptions
module ImplementationParams = Lsp__Types.ImplementationParams
module ImplementationRegistrationOptions = Lsp__Types.ImplementationRegistrationOptions
module InitializeError = Lsp__Types.InitializeError
module InitializeParams = Lsp__Types.InitializeParams
module WorkspaceFoldersServerCapabilities = Lsp__Types.WorkspaceFoldersServerCapabilities
module SelectionRangeOptions = Lsp__Types.SelectionRangeOptions
module SelectionRangeRegistrationOptions = Lsp__Types.SelectionRangeRegistrationOptions
module RenameOptions = Lsp__Types.RenameOptions
module ReferenceOptions = Lsp__Types.ReferenceOptions
module TypeDefinitionOptions = Lsp__Types.TypeDefinitionOptions
module TypeDefinitionRegistrationOptions = Lsp__Types.TypeDefinitionRegistrationOptions
module SignatureHelpOptions = Lsp__Types.SignatureHelpOptions
module SaveOptions = Lsp__Types.SaveOptions
module TextDocumentSyncKind = Lsp__Types.TextDocumentSyncKind
module TextDocumentSyncOptions = Lsp__Types.TextDocumentSyncOptions
module ServerCapabilities = Lsp__Types.ServerCapabilities
module InitializeResult = Lsp__Types.InitializeResult
module LogMessageParams = Lsp__Types.LogMessageParams
module MessageActionItem = Lsp__Types.MessageActionItem
module MessageType = Lsp__Types.MessageType
module ParameterInformation = Lsp__Types.ParameterInformation
module PrepareRenameParams = Lsp__Types.PrepareRenameParams
module ProgressParams = Lsp__Types.ProgressParams
module PublishDiagnosticsParams = Lsp__Types.PublishDiagnosticsParams
module ReferenceContext = Lsp__Types.ReferenceContext
module ReferenceParams = Lsp__Types.ReferenceParams
module ReferenceRegistrationOptions = Lsp__Types.ReferenceRegistrationOptions
module Registration = Lsp__Types.Registration
module RegistrationParams = Lsp__Types.RegistrationParams
module RenameParams = Lsp__Types.RenameParams
module RenameRegistrationOptions = Lsp__Types.RenameRegistrationOptions
module SelectionRange = Lsp__Types.SelectionRange
module SelectionRangeParams = Lsp__Types.SelectionRangeParams
module ShowMessageParams = Lsp__Types.ShowMessageParams
module ShowMessageRequestParams = Lsp__Types.ShowMessageRequestParams
module SignatureInformation = Lsp__Types.SignatureInformation
module SignatureHelp = Lsp__Types.SignatureHelp
module SignatureHelpTriggerKind = Lsp__Types.SignatureHelpTriggerKind
module SignatureHelpContext = Lsp__Types.SignatureHelpContext
module SignatureHelpParams = Lsp__Types.SignatureHelpParams
module SignatureHelpRegistrationOptions = Lsp__Types.SignatureHelpRegistrationOptions
module SymbolInformation = Lsp__Types.SymbolInformation
module TextDocumentChangeRegistrationOptions = Lsp__Types.TextDocumentChangeRegistrationOptions
module TextDocumentSaveReason = Lsp__Types.TextDocumentSaveReason
module TextDocumentSaveRegistrationOptions = Lsp__Types.TextDocumentSaveRegistrationOptions
module TypeDefinitionParams = Lsp__Types.TypeDefinitionParams
module Unregistration = Lsp__Types.Unregistration
module UnregistrationParams = Lsp__Types.UnregistrationParams
module WatchKind = Lsp__Types.WatchKind
module WillSaveTextDocumentParams = Lsp__Types.WillSaveTextDocumentParams
module WorkDoneProgressBegin = Lsp__Types.WorkDoneProgressBegin
module WorkDoneProgressCancelParams = Lsp__Types.WorkDoneProgressCancelParams
module WorkDoneProgressCreateParams = Lsp__Types.WorkDoneProgressCreateParams
module WorkDoneProgressEnd = Lsp__Types.WorkDoneProgressEnd
module WorkDoneProgressReport = Lsp__Types.WorkDoneProgressReport
module WorkspaceSymbolOptions = Lsp__Types.WorkspaceSymbolOptions
module WorkspaceSymbolParams = Lsp__Types.WorkspaceSymbolParams
module WorkspaceSymbolRegistrationOptions = Lsp__Types.WorkspaceSymbolRegistrationOptions
module CodeActionResult = Lsp__Types.CodeActionResult
module Locations = Lsp__Types.Locations
type doc_state = Jsonrpc2.doc_state
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt/module-type-IO/index.html b/dev/linol-lwt/Linol_lwt/module-type-IO/index.html deleted file mode 100644 index 6a7eaf13..00000000 --- a/dev/linol-lwt/Linol_lwt/module-type-IO/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -IO (linol-lwt.Linol_lwt.IO)

Module type Linol_lwt.IO

type 'a t
val return : 'a -> 'a t
val failwith : string -> 'a t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
type in_channel
type out_channel
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__/.dune-keep b/dev/linol-lwt/Linol_lwt__/.dune-keep deleted file mode 100644 index e69de29b..00000000 diff --git a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/IO/index.html b/dev/linol-lwt/Linol_lwt__/Jsonrpc2/IO/index.html deleted file mode 100644 index 3edc3895..00000000 --- a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/IO/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -IO (linol-lwt.Linol_lwt__.Jsonrpc2.IO)

Module Jsonrpc2.IO

type 'a t = 'a Linol_lwt.Task.m
val return : 'a -> 'a t
val failwith : string -> 'a t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
type in_channel = Lwt_io.input Lwt_io.channel
type out_channel = Lwt_io.output Lwt_io.channel
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/class-base_server/index.html b/dev/linol-lwt/Linol_lwt__/Jsonrpc2/class-base_server/index.html deleted file mode 100644 index a92400af..00000000 --- a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/class-base_server/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -base_server (linol-lwt.Linol_lwt__.Jsonrpc2.base_server)

Class Jsonrpc2.base_server

method must_quit : bool
method virtual on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t
method virtual on_request : a. 'a Lsp.Client_request.t -> 'a IO.t
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/class-notify_back/index.html b/dev/linol-lwt/Linol_lwt__/Jsonrpc2/class-notify_back/index.html deleted file mode 100644 index 0f15fa0c..00000000 --- a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/class-notify_back/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -notify_back (linol-lwt.Linol_lwt__.Jsonrpc2.notify_back)

Class Jsonrpc2.notify_back

method send_diagnostic : Lsp.Types.Diagnostic.t list -> unit IO.t
method send_log_msg : type_:Lsp__Types.MessageType.t -> string -> unit IO.t
method send_notification : Lsp.Server_notification.t -> unit IO.t
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/class-server/index.html b/dev/linol-lwt/Linol_lwt__/Jsonrpc2/class-server/index.html deleted file mode 100644 index ec0ac7e0..00000000 --- a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/class-server/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -server (linol-lwt.Linol_lwt__.Jsonrpc2.server)

Class Jsonrpc2.server

val docs : (Lsp.Types.DocumentUri.t, doc_state) Stdlib.Hashtbl.t
val mutable _quit : bool
method config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t
method find_doc : Lsp.Types.DocumentUri.t -> doc_state option
method must_quit : bool
method virtual on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t
method virtual on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t
method virtual on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t
method on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t
method on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t
method on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t
method on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t
method on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t
method on_request : a. 'a Lsp.Client_request.t -> 'a IO.t
method on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/index.html b/dev/linol-lwt/Linol_lwt__/Jsonrpc2/index.html deleted file mode 100644 index 8c54304e..00000000 --- a/dev/linol-lwt/Linol_lwt__/Jsonrpc2/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Jsonrpc2 (linol-lwt.Linol_lwt__.Jsonrpc2)

Module Linol_lwt__.Jsonrpc2

module IO : Linol.IO with type 'a t = 'a Linol_lwt.Task.m and type in_channel = Lwt_io.input Lwt_io.channel and type out_channel = Lwt_io.output Lwt_io.channel
type json = Yojson.Safe.t
type t

A jsonrpc2 connection.

include module type of sig ... end
module Position = Lsp.Types.Position
module Range = Lsp.Types.Range
class virtual base_server : object ... end
class notify_back : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> ?⁠version:int -> uri:Lsp.Types.DocumentUri.t -> unit -> object ... end
type doc_state = Linol.Make(IO).doc_state = {
uri : Lsp.Types.DocumentUri.t;
languageId : string;
version : int;
content : string;
}
class virtual server : object ... end
val create : ic:IO.in_channel -> oc:IO.out_channel -> server -> t

Create a connection from the pair of channels

val create_stdio : server -> t
val run : t -> unit Linol_lwt.Task.t -> unit Linol_lwt.Task.m

Listen for incoming messages and responses

\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__/Task/Infix/index.html b/dev/linol-lwt/Linol_lwt__/Task/Infix/index.html deleted file mode 100644 index 321b22c9..00000000 --- a/dev/linol-lwt/Linol_lwt__/Task/Infix/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Infix (linol-lwt.Linol_lwt__.Task.Infix)

Module Task.Infix

val let+ : 'a m -> ('a -> 'b) -> 'b m
val let* : 'a m -> ('a -> 'b m) -> 'b m
val (>|=) : 'a m -> ('a -> 'b) -> 'b m
val (>>=) : 'a m -> ('a -> 'b m) -> 'b m
val and+ : 'a m -> 'b m -> ('a * 'b) m
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__/Task/Wrapped_error/index.html b/dev/linol-lwt/Linol_lwt__/Task/Wrapped_error/index.html deleted file mode 100644 index a795bb2a..00000000 --- a/dev/linol-lwt/Linol_lwt__/Task/Wrapped_error/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Wrapped_error (linol-lwt.Linol_lwt__.Task.Wrapped_error)

Module Task.Wrapped_error

type 'a task = 'a t
type t =
| E : {
task : 'a task;
e : exn;
} -> t
exception Wrapped of t

An exception caught and re-launched from a task

val pp : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__/Task/index.html b/dev/linol-lwt/Linol_lwt__/Task/index.html deleted file mode 100644 index c67b0d8c..00000000 --- a/dev/linol-lwt/Linol_lwt__/Task/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Task (linol-lwt.Linol_lwt__.Task)

Module Linol_lwt__.Task

Tasks

Tasks built on top of Lwt, for cooperative multi-threading.

type 'a t

A task

type 'a m = 'a Lwt.t

Computation within the task

type cancel
val return : 'a -> 'a m
val start : ?⁠descr:string -> ?⁠cancel:cancel -> ('a t -> 'a m) -> 'a t
val descr : _ t -> string option
val run : 'a t -> ('a, exn) Stdlib.result
val run_sub : parent:_ t -> ?⁠descr:string -> ?⁠cancel:cancel -> ('a t -> 'a m) -> ('a, exn) Stdlib.result m
module Wrapped_error : sig ... end
val unwrap : ('a, exn) Stdlib.result -> 'a m
val is_cancelled : _ t -> bool
val cancel : _ t -> unit
val pause : _ t -> unit m
val wait_all : (unit, exn) Stdlib.result m list -> (unit, exn) Stdlib.result m
module Infix : sig ... end
include module type of Infix
val let+ : 'a m -> ('a -> 'b) -> 'b m
val let* : 'a m -> ('a -> 'b m) -> 'b m
val (>|=) : 'a m -> ('a -> 'b) -> 'b m
val (>>=) : 'a m -> ('a -> 'b m) -> 'b m
val and+ : 'a m -> 'b m -> ('a * 'b) m
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__/index.html b/dev/linol-lwt/Linol_lwt__/index.html deleted file mode 100644 index 4ef0b848..00000000 --- a/dev/linol-lwt/Linol_lwt__/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Linol_lwt__ (linol-lwt.Linol_lwt__)

Module Linol_lwt__

module Jsonrpc2 : sig ... end
module Task : sig ... end
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__Jsonrpc2/.dune-keep b/dev/linol-lwt/Linol_lwt__Jsonrpc2/.dune-keep deleted file mode 100644 index e69de29b..00000000 diff --git a/dev/linol-lwt/Linol_lwt__Jsonrpc2/IO/index.html b/dev/linol-lwt/Linol_lwt__Jsonrpc2/IO/index.html deleted file mode 100644 index c02cc914..00000000 --- a/dev/linol-lwt/Linol_lwt__Jsonrpc2/IO/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -IO (linol-lwt.Linol_lwt__Jsonrpc2.IO)

Module Linol_lwt__Jsonrpc2.IO

type 'a t = 'a Linol_lwt.Task.m
val return : 'a -> 'a t
val failwith : string -> 'a t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
type in_channel = Lwt_io.input Lwt_io.channel
type out_channel = Lwt_io.output Lwt_io.channel
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__Jsonrpc2/class-base_server/index.html b/dev/linol-lwt/Linol_lwt__Jsonrpc2/class-base_server/index.html deleted file mode 100644 index 4dfcfc25..00000000 --- a/dev/linol-lwt/Linol_lwt__Jsonrpc2/class-base_server/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -base_server (linol-lwt.Linol_lwt__Jsonrpc2.base_server)

Class Linol_lwt__Jsonrpc2.base_server

method must_quit : bool
method virtual on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t
method virtual on_request : a. 'a Lsp.Client_request.t -> 'a IO.t
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__Jsonrpc2/class-notify_back/index.html b/dev/linol-lwt/Linol_lwt__Jsonrpc2/class-notify_back/index.html deleted file mode 100644 index 5862b1c1..00000000 --- a/dev/linol-lwt/Linol_lwt__Jsonrpc2/class-notify_back/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -notify_back (linol-lwt.Linol_lwt__Jsonrpc2.notify_back)

Class Linol_lwt__Jsonrpc2.notify_back

method send_diagnostic : Lsp.Types.Diagnostic.t list -> unit IO.t
method send_log_msg : type_:Lsp__Types.MessageType.t -> string -> unit IO.t
method send_notification : Lsp.Server_notification.t -> unit IO.t
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__Jsonrpc2/class-server/index.html b/dev/linol-lwt/Linol_lwt__Jsonrpc2/class-server/index.html deleted file mode 100644 index 7c5b44f1..00000000 --- a/dev/linol-lwt/Linol_lwt__Jsonrpc2/class-server/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -server (linol-lwt.Linol_lwt__Jsonrpc2.server)

Class Linol_lwt__Jsonrpc2.server

val docs : (Lsp.Types.DocumentUri.t, doc_state) Stdlib.Hashtbl.t
val mutable _quit : bool
method config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t
method find_doc : Lsp.Types.DocumentUri.t -> doc_state option
method must_quit : bool
method virtual on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t
method virtual on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t
method virtual on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t
method on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t
method on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t
method on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t
method on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t
method on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t
method on_request : a. 'a Lsp.Client_request.t -> 'a IO.t
method on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__Jsonrpc2/index.html b/dev/linol-lwt/Linol_lwt__Jsonrpc2/index.html deleted file mode 100644 index 7fcf4577..00000000 --- a/dev/linol-lwt/Linol_lwt__Jsonrpc2/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Linol_lwt__Jsonrpc2 (linol-lwt.Linol_lwt__Jsonrpc2)

Module Linol_lwt__Jsonrpc2

module IO : Linol.IO with type 'a t = 'a Linol_lwt.Task.m and type in_channel = Lwt_io.input Lwt_io.channel and type out_channel = Lwt_io.output Lwt_io.channel
type json = Yojson.Safe.t
type t

A jsonrpc2 connection.

include module type of sig ... end
module Position = Lsp.Types.Position
module Range = Lsp.Types.Range
class virtual base_server : object ... end
class notify_back : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> ?⁠version:int -> uri:Lsp.Types.DocumentUri.t -> unit -> object ... end
type doc_state = Linol.Make(IO).doc_state = {
uri : Lsp.Types.DocumentUri.t;
languageId : string;
version : int;
content : string;
}
class virtual server : object ... end
val create : ic:IO.in_channel -> oc:IO.out_channel -> server -> t

Create a connection from the pair of channels

val create_stdio : server -> t
val run : t -> unit Linol_lwt.Task.t -> unit Linol_lwt.Task.m

Listen for incoming messages and responses

\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__Task/.dune-keep b/dev/linol-lwt/Linol_lwt__Task/.dune-keep deleted file mode 100644 index e69de29b..00000000 diff --git a/dev/linol-lwt/Linol_lwt__Task/Infix/index.html b/dev/linol-lwt/Linol_lwt__Task/Infix/index.html deleted file mode 100644 index 6e2de7ab..00000000 --- a/dev/linol-lwt/Linol_lwt__Task/Infix/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Infix (linol-lwt.Linol_lwt__Task.Infix)

Module Linol_lwt__Task.Infix

val let+ : 'a m -> ('a -> 'b) -> 'b m
val let* : 'a m -> ('a -> 'b m) -> 'b m
val (>|=) : 'a m -> ('a -> 'b) -> 'b m
val (>>=) : 'a m -> ('a -> 'b m) -> 'b m
val and+ : 'a m -> 'b m -> ('a * 'b) m
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__Task/Wrapped_error/index.html b/dev/linol-lwt/Linol_lwt__Task/Wrapped_error/index.html deleted file mode 100644 index 628f7ccd..00000000 --- a/dev/linol-lwt/Linol_lwt__Task/Wrapped_error/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Wrapped_error (linol-lwt.Linol_lwt__Task.Wrapped_error)

Module Linol_lwt__Task.Wrapped_error

type 'a task = 'a t
type t =
| E : {
task : 'a task;
e : exn;
} -> t
exception Wrapped of t

An exception caught and re-launched from a task

val pp : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
\ No newline at end of file diff --git a/dev/linol-lwt/Linol_lwt__Task/index.html b/dev/linol-lwt/Linol_lwt__Task/index.html deleted file mode 100644 index b8256d4e..00000000 --- a/dev/linol-lwt/Linol_lwt__Task/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Linol_lwt__Task (linol-lwt.Linol_lwt__Task)

Module Linol_lwt__Task

Tasks

Tasks built on top of Lwt, for cooperative multi-threading.

type 'a t

A task

type 'a m = 'a Lwt.t

Computation within the task

type cancel
val return : 'a -> 'a m
val start : ?⁠descr:string -> ?⁠cancel:cancel -> ('a t -> 'a m) -> 'a t
val descr : _ t -> string option
val run : 'a t -> ('a, exn) Stdlib.result
val run_sub : parent:_ t -> ?⁠descr:string -> ?⁠cancel:cancel -> ('a t -> 'a m) -> ('a, exn) Stdlib.result m
module Wrapped_error : sig ... end
val unwrap : ('a, exn) Stdlib.result -> 'a m
val is_cancelled : _ t -> bool
val cancel : _ t -> unit
val pause : _ t -> unit m
val wait_all : (unit, exn) Stdlib.result m list -> (unit, exn) Stdlib.result m
module Infix : sig ... end
include module type of Infix
val let+ : 'a m -> ('a -> 'b) -> 'b m
val let* : 'a m -> ('a -> 'b m) -> 'b m
val (>|=) : 'a m -> ('a -> 'b) -> 'b m
val (>>=) : 'a m -> ('a -> 'b m) -> 'b m
val and+ : 'a m -> 'b m -> ('a * 'b) m
\ No newline at end of file diff --git a/dev/linol-lwt/index.html b/dev/linol-lwt/index.html deleted file mode 100644 index b63a0b23..00000000 --- a/dev/linol-lwt/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -index (linol-lwt.index)

linol-lwt index

Library linol-lwt

The entry point of this library is the module: Linol_lwt.

\ No newline at end of file diff --git a/dev/linol/Linol/.dune-keep b/dev/linol/Linol/.dune-keep deleted file mode 100644 index e69de29b..00000000 diff --git a/dev/linol/Linol/Make/argument-1-IO/index.html b/dev/linol/Linol/Make/argument-1-IO/index.html deleted file mode 100644 index 708f70a5..00000000 --- a/dev/linol/Linol/Make/argument-1-IO/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -1-IO (linol.Linol.Make.1-IO)

Parameter Make.1-IO

type 'a t
val return : 'a -> 'a t
val failwith : string -> 'a t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
type in_channel
type out_channel
\ No newline at end of file diff --git a/dev/linol/Linol/Make/class-base_server/index.html b/dev/linol/Linol/Make/class-base_server/index.html deleted file mode 100644 index 362c82fc..00000000 --- a/dev/linol/Linol/Make/class-base_server/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -base_server (linol.Linol.Make.base_server)

Class Make.base_server

The server baseclass

method virtual on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t
method virtual on_request : a. 'a Lsp.Client_request.t -> 'a IO.t
method must_quit : < must_quit : bool; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; .. > -> bool

Set to true if the client requested to exit

\ No newline at end of file diff --git a/dev/linol/Linol/Make/class-notify_back/index.html b/dev/linol/Linol/Make/class-notify_back/index.html deleted file mode 100644 index 939d3afb..00000000 --- a/dev/linol/Linol/Make/class-notify_back/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -notify_back (linol.Linol.Make.notify_back)

Class Make.notify_back

A wrapper to more easily reply to notifications

method send_log_msg : < send_diagnostic : Lsp.Types.Diagnostic.t list -> unit IO.t; send_log_msg : type_:Lsp__Types.MessageType.t -> string -> unit IO.t; send_notification : Lsp.Server_notification.t -> unit IO.t; .. > -> type_:Lsp__Types.MessageType.t -> string -> unit IO.t

Send a log message to the editor

method send_diagnostic : < send_diagnostic : Lsp.Types.Diagnostic.t list -> unit IO.t; send_log_msg : type_:Lsp__Types.MessageType.t -> string -> unit IO.t; send_notification : Lsp.Server_notification.t -> unit IO.t; .. > -> Lsp.Types.Diagnostic.t list -> unit IO.t

Send diagnostics for the current document

method send_notification : < send_diagnostic : Lsp.Types.Diagnostic.t list -> unit IO.t; send_log_msg : type_:Lsp__Types.MessageType.t -> string -> unit IO.t; send_notification : Lsp.Server_notification.t -> unit IO.t; .. > -> Lsp.Server_notification.t -> unit IO.t

Send a notification (general purpose method)

\ No newline at end of file diff --git a/dev/linol/Linol/Make/class-server/index.html b/dev/linol/Linol/Make/class-server/index.html deleted file mode 100644 index 9bfc3938..00000000 --- a/dev/linol/Linol/Make/class-server/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -server (linol.Linol.Make.server)

Class Make.server

An easily overloadable class. Pick the methods you want to support. The user must provide at least the callbacks for document lifecycle: open, close, update. The most basic LSP server should check documents when they're updated and report diagnostics back to the editor.

inherit base_server
val mutable _quit : bool
val docs : (Lsp.Types.DocumentUri.t, doc_state) Stdlib.Hashtbl.t
method must_quit : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> bool
method find_doc : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> Lsp.Types.DocumentUri.t -> doc_state option

Find current state of the given document, if present.

method on_request_unhandled : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> r. 'r Lsp.Client_request.t -> 'r IO.t

Overload to process other requests

method config_sync_opts : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> Lsp.Types.TextDocumentSyncOptions.t

Parameter for how to synchronize content with the editor

method on_req_initialize : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t
method on_req_hover : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t

Called when the user hovers on some identifier in the document

method on_req_completion : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t

Called when the user requests completion in the document

method on_req_definition : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t

Called when the user wants to jump-to-definition

method on_request : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> a. 'a Lsp.Client_request.t -> 'a IO.t
method virtual on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t

Called when a document is opened

method virtual on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t
method virtual on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t

Called when the document changes.

method on_notification : < config_sync_opts : Lsp.Types.TextDocumentSyncOptions.t; find_doc : Lsp.Types.DocumentUri.t -> doc_state option; must_quit : bool; on_notif_doc_did_change : notify_back:notify_back -> Lsp.Types.VersionedTextDocumentIdentifier.t -> Lsp.Types.TextDocumentContentChangeEvent.t list -> old_content:string -> new_content:string -> unit IO.t; on_notif_doc_did_close : notify_back:notify_back -> Lsp.Types.TextDocumentIdentifier.t -> unit IO.t; on_notif_doc_did_open : notify_back:notify_back -> Lsp.Types.TextDocumentItem.t -> content:string -> unit IO.t; on_notification : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t; on_req_completion : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> ctx:Lsp__Types.CompletionContext.t option -> doc_state -> [ `CompletionList of Lsp__.Types.CompletionList.t | `List of Lsp__.Types.CompletionItem.t list ] option IO.t; on_req_definition : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Locations.t option IO.t; on_req_hover : uri:Lsp__Types.DocumentUri.t -> pos:Lsp__Types.Position.t -> doc_state -> Lsp.Types.Hover.t option IO.t; on_req_initialize : Lsp.Types.InitializeParams.t -> Lsp.Types.InitializeResult.t IO.t; on_request : a. 'a Lsp.Client_request.t -> 'a IO.t; on_request_unhandled : r. 'r Lsp.Client_request.t -> 'r IO.t; .. > -> notify_back:(Lsp.Server_notification.t -> unit IO.t) -> Lsp.Client_notification.t -> unit IO.t
\ No newline at end of file diff --git a/dev/linol/Linol/Make/index.html b/dev/linol/Linol/Make/index.html deleted file mode 100644 index 2be6b695..00000000 --- a/dev/linol/Linol/Make/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Make (linol.Linol.Make)

Module Linol.Make

Server interface for some IO substrate

Parameters

Signature

module Position = Lsp.Types.Position
module Range = Lsp.Types.Range
class virtual base_server : object ... end

The server baseclass

class notify_back : notify_back:(Lsp.Server_notification.t -> unit IO.t) -> ?⁠version:int option -> uri:Lsp.Types.DocumentUri.t -> unit -> object ... end

A wrapper to more easily reply to notifications

type doc_state = {
uri : Lsp.Types.DocumentUri.t;
languageId : string;
version : int;
content : string;
}

Current state of a document.

class virtual server : object ... end

An easily overloadable class. Pick the methods you want to support. The user must provide at least the callbacks for document lifecycle: open, close, update. The most basic LSP server should check documents when they're updated and report diagnostics back to the editor.

\ No newline at end of file diff --git a/dev/linol/Linol/index.html b/dev/linol/Linol/index.html deleted file mode 100644 index 56204b49..00000000 --- a/dev/linol/Linol/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Linol (linol.Linol)

Module Linol

Linol

Abstraction over The "Lsp" library, to make it easier to develop LSP servers in OCaml (but not necessarily for OCaml).

module type IO = sig ... end
module Make : functor (IO : IO) -> sig ... end
\ No newline at end of file diff --git a/dev/linol/Linol/module-type-IO/index.html b/dev/linol/Linol/module-type-IO/index.html deleted file mode 100644 index 47835cab..00000000 --- a/dev/linol/Linol/module-type-IO/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -IO (linol.Linol.IO)

Module type Linol.IO

Parametrized IO Interface

type 'a t
val return : 'a -> 'a t
val failwith : string -> 'a t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
type in_channel
type out_channel
\ No newline at end of file diff --git a/dev/linol/index.html b/dev/linol/index.html deleted file mode 100644 index a6b368a2..00000000 --- a/dev/linol/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -index (linol.index)

linol index

Library linol

The entry point of this library is the module: Linol.

\ No newline at end of file diff --git a/dev/odoc.css b/dev/odoc.css deleted file mode 100644 index c86c417e..00000000 --- a/dev/odoc.css +++ /dev/null @@ -1,764 +0,0 @@ -@charset "UTF-8"; -/* Copyright (c) 2016 The odoc contributors. All rights reserved. - Distributed under the ISC license, see terms at the end of the file. - odoc 1.4.0 */ - -/* Fonts */ -@import url('https://fonts.googleapis.com/css?family=Fira+Mono:400,500'); -@import url('https://fonts.googleapis.com/css?family=Noticia+Text:400,400i,700'); -@import url('https://fonts.googleapis.com/css?family=Fira+Sans:400,400i,500,500i,600,600i,700,700i'); - - -/* Reset a few things. */ - -html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: inherit; - font: inherit; - line-height: inherit; - vertical-align: baseline; - text-align: inherit; - color: inherit; - background: transparent; -} - -table { - border-collapse: collapse; - border-spacing: 0; -} - -*, *:before, *:after { - box-sizing: border-box; -} - -html { - font-size: 15px; -} - -body { - font-family: "Fira Sans", Helvetica, Arial, sans-serif; - text-align: left; - color: #333; - background: #FFFFFF; -} - -.content { - max-width: 90ex; - margin-left: calc(10vw + 20ex); - margin-right: 4ex; - margin-top: 20px; - margin-bottom: 50px; - font-family: "Noticia Text", Georgia, serif; - line-height: 1.5; -} - -.content>header { - margin-bottom: 30px; -} - -.content>header nav { - font-family: "Fira Sans", Helvetica, Arial, sans-serif; -} - -/* Basic markup elements */ - -b, strong { - font-weight: 500; -} - -i, em { - font-style: italic; -} - -sup { - vertical-align: super; -} - -sub { - vertical-align: sub; -} - -sup, sub { - font-size: 12px; - line-height: 0; - margin-left: 0.2ex; -} - -pre { - margin-top: 0.8em; - margin-bottom: 1.2em; -} - -p, ul, ol { - margin-top: 0.5em; - margin-bottom: 1em; -} -ul, ol { - list-style-position: outside -} - -ul>li { - margin-left: 22px; -} - -ol>li { - margin-left: 27.2px; -} - -li>*:first-child { - margin-top: 0 -} - -/* Text alignements, this should be forbidden. */ - -.left { - text-align: left; -} - -.right { - text-align: right; -} - -.center { - text-align: center; -} - -/* Links and anchors */ - -a { - text-decoration: none; - color: #2C5CBD; -} - -a:hover { - box-shadow: 0 1px 0 0 #2C5CBD; -} - -/* Linked highlight */ -*:target { - background-color: rgba(187,239,253,0.3) !important; - box-shadow: 0 0px 0 1px rgba(187,239,253,0.8) !important; - border-radius: 1px; -} - -*:hover>a.anchor { - visibility: visible; -} - -a.anchor:before { - content: "#" -} - -a.anchor:hover { - box-shadow: none; - text-decoration: none; - color: #555; -} - -a.anchor { - visibility: hidden; - position: absolute; - /* top: 0px; */ - /* margin-left: -3ex; */ - margin-left: -1.3em; - font-weight: normal; - font-style: normal; - padding-right: 0.4em; - padding-left: 0.4em; - /* To remain selectable */ - color: #d5d5d5; -} - -.spec > a.anchor { - margin-left: -2.3em; - padding-right: 0.9em; -} - -.xref-unresolved { - color: #2C5CBD; -} -.xref-unresolved:hover { - box-shadow: 0 1px 0 0 #CC6666; -} - -/* Section and document divisions. - Until at least 4.03 many of the modules of the stdlib start at .h7, - we restart the sequence there like h2 */ - -h1, h2, h3, h4, h5, h6, .h7, .h8, .h9, .h10 { - font-family: "Fira Sans", Helvetica, Arial, sans-serif; - font-weight: 400; - margin: 0.5em 0 0.5em 0; - padding-top: 0.1em; - line-height: 1.2; - overflow-wrap: break-word; -} - -h1 { - font-weight: 500; - font-size: 2.441em; - margin-top: 1.214em; -} - -h1 { - font-weight: 500; - font-size: 1.953em; - box-shadow: 0 1px 0 0 #ddd; -} - -h2 { - font-size: 1.563em; -} - -h3 { - font-size: 1.25em; -} - -small, .font_small { - font-size: 0.8em; -} - -h1 code, h1 tt { - font-size: inherit; - font-weight: inherit; -} - -h2 code, h2 tt { - font-size: inherit; - font-weight: inherit; -} - -h3 code, h3 tt { - font-size: inherit; - font-weight: inherit; -} - -h3 code, h3 tt { - font-size: inherit; - font-weight: inherit; -} - -h4 { - font-size: 1.12em; -} - - -/* Preformatted and code */ - -tt, code, pre { - font-family: "Fira Mono", courier; - font-weight: 400; -} - -pre { - padding: 0.1em; - border: 1px solid #eee; - border-radius: 5px; - overflow-x: auto; -} - -p code, li code { - background-color: #f6f8fa; - color: #0d2b3e; - border-radius: 3px; - padding: 0 0.3ex; -} - -p a > code { - color: #2C5CBD; -} - -/* Code blocks (e.g. Examples) */ - -pre code { - font-size: 0.893rem; -} - -/* Code lexemes */ - -.keyword { - font-weight: 500; -} - -/* Module member specification */ - -.spec:not(.include), .spec.include details summary { - background-color: #f6f8fa; - border-radius: 3px; - border-left: 4px solid #5c9cf5; - border-right: 5px solid transparent; - padding: 0.35em 0.5em; -} - -.spec.include details summary:hover { - background-color: #ebeff2; -} - -dl, div.spec, .doc, aside { - margin-bottom: 20px; -} - -dl > dd { - padding: 0.5em; -} - -dd> :first-child { - margin-top: 0; -} - -dl:last-child, dd> :last-child, aside:last-child, article:last-child { - margin-bottom: 0; -} - -dt+dt { - margin-top: 15px; -} - -section+section, section > header + dl { - margin-top: 25px; -} - -.spec.type .variant { - margin-left: 2ch; -} -.spec.type .variant p { - margin: 0; - font-style: italic; -} -.spec.type .record { - margin-left: 2ch; -} -.spec.type .record p { - margin: 0; - font-style: italic; -} - -div.def { - margin-top: 0; - text-indent: -2ex; - padding-left: 2ex; -} - -div.def+div.doc { - margin-left: 1ex; - margin-top: 2.5px -} - -div.doc>*:first-child { - margin-top: 0; -} - -/* The elements other than heading should be wrapped in