elvish/pkg/pkg.go
Qi Xiao 9112eb1ab2 Simplify how .elv files are embedded for builtin documentation.
Instead of having each individual module embed their .elv files and collect all
of them in pkg/mods/doc, have a single embed.FS at pkg that includes everything,
and use that pkg/mods/doc.

Implement a function that extracts all module elvdocs, and put it in pkg/elvdoc.
2024-01-08 16:44:35 +00:00

22 lines
875 B
Go

// Package pkg is the root of packages that implement Elvish.
package pkg
import "embed"
// ElvFiles contains the Elvish sources found inside pkg - the .d.elv files for
// modules implemented in Go and the actual sources of bundled modules. It is
// defined to support reading documentation of builtin modules from Elvish
// itself.
//
// Some of these files may be embedded as a string variable elsewhere. This is
// fine since the compiler is smart enough to only include one copy of the same
// file in the binary (as least as of Go 1.21).
//
// This is only used by [src.elv.sh/pkg/mods/doc], but has to live in this
// package because go:embed only supports embedding files found in the current
// directory and its descendents, and this directory is the lowest common
// ancestor of these files.
//
//go:embed eval/*.elv edit/*.elv mods/*/*.elv
var ElvFiles embed.FS