mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-01 00:33:05 +08:00
9112eb1ab2
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.
22 lines
875 B
Go
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
|