hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 7ee0e15d9502341bbda89b73e80abd13df510980
parent 7f6580d4eb42fbbf92ebba6a524abcaa4c5ab943
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue, 20 Apr 2021 13:05:47 -0400

haredoc: enumerate submodules

Diffstat:
Mcmd/haredoc/html.ha | 15+++++++++++++++
Mhare/module/scan.ha | 3+++
Mhare/module/types.ha | 1+
Ahash/README | 1+
4 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/cmd/haredoc/html.ha b/cmd/haredoc/html.ha @@ -38,6 +38,21 @@ fn emit_html(ctx: *context) (void | error) = { }, }; + if (len(ctx.version.subdirs) != 0) { + // TODO: Verify that these are actually modules + fmt::println("<h3>Submodules</h3>")?; + fmt::println("<ul class='submodules'>")?; + for (let i = 0z; i < len(ctx.version.subdirs); i += 1) { + let dir = ctx.version.subdirs[i]; + fmt::printf("<li><a href='"); + html::escape(os::stdout, dir); + fmt::printf("'>"); + html::escape(os::stdout, dir); + fmt::printfln("</a></li>"); + }; + fmt::println("</ul>")?; + }; + fmt::println("<h3>Index</h3>")?; if (len(decls.types) != 0) { fmt::println("<h4>Types</h4>")?; diff --git a/hare/module/scan.ha b/hare/module/scan.ha @@ -160,6 +160,9 @@ fn scan_directory( if (len(d) == 0 || ( !strings::has_prefix(name, "+") && !strings::has_prefix(name, "-"))) { + if (!strings::has_prefix(name, ".")) { + append(ver.subdirs, strings::dup(name)); + }; continue; }; if (!tagcompat(ctx.tags, tags)) { diff --git a/hare/module/types.ha b/hare/module/types.ha @@ -30,6 +30,7 @@ export type version = struct { basedir: str, depends: []ast::ident, inputs: []input, + subdirs: []str, }; export type filetype = enum { diff --git a/hash/README b/hash/README @@ -0,0 +1 @@ +hash provides a generic interface for use with hashing functions.