Documentation
¶
Overview ¶
Package embed provides commands for exploring the embedded filesystem.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CatCmd = &cobra.Command{ Use: "cat <file>...", Short: "Display embedded file contents", Long: `Display the contents of embedded files. Similar to the Unix cat command, this reads and displays the contents of one or more files from the embedded filesystem. Examples: starmap embed cat catalog/providers/openai.yaml starmap embed cat sources/models.dev/api.json starmap embed cat -n catalog/models.yaml # Show line numbers`, Args: cobra.MinimumNArgs(1), RunE: func(_ *cobra.Command, args []string) error { fsys := embedutil.GetEmbeddedFS() for i, arg := range args { targetPath := embedutil.NormalizePath(arg) if i > 0 { fmt.Println() } if err := catFile(fsys, targetPath); err != nil { return err } } return nil }, }
CatCmd represents the cat command for inspecting embedded filesystem.
View Source
var LsCmd = &cobra.Command{ Use: "ls [path]", Short: "List embedded files and directories", Long: `List files and directories in the embedded filesystem. Similar to the Unix ls command, this shows the contents of embedded directories and files. By default, shows files in the root directory. Examples: starmap embed ls # List root directory starmap embed ls catalog # List catalog directory starmap embed ls -l catalog/providers # Long format listing starmap embed ls -lh sources # Long format with human-readable sizes starmap embed ls -lah sources # Long, all files, human-readable sizes starmap embed ls --help # Show help (or use -?)`, Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { if lsHuman && !lsLong { return cmd.Help() } targetPath := "." if len(args) > 0 { targetPath = embedutil.NormalizePath(args[0]) } fsys := embedutil.GetEmbeddedFS() return listPath(fsys, targetPath) }, }
LsCmd represents the ls command for inspecting embedded filesystem.
View Source
var StatCmd = &cobra.Command{ Use: "stat <path>...", Short: "Display embedded file/directory status", Long: `Display detailed information about embedded files and directories. Similar to the Unix stat command, this shows comprehensive information about files and directories in the embedded filesystem including size, permissions, and type. Examples: starmap embed stat catalog starmap embed stat sources/models.dev/api.json starmap embed stat catalog/providers/openai.yaml catalog/models.yaml`, Args: cobra.MinimumNArgs(1), RunE: func(_ *cobra.Command, args []string) error { fsys := embedutil.GetEmbeddedFS() for i, arg := range args { targetPath := embedutil.NormalizePath(arg) if i > 0 { fmt.Println() } if err := statPath(fsys, targetPath); err != nil { return err } } return nil }, }
StatCmd represents the stat command for inspecting embedded filesystem.
View Source
var TreeCmd = &cobra.Command{ Use: "tree [path]", Short: "Display embedded directory tree", Long: `Display the embedded filesystem as a tree structure. Similar to the Unix tree command, this shows directories and files in a hierarchical tree format with ASCII art. Examples: starmap embed tree # Show full tree starmap embed tree catalog # Show catalog directory tree starmap embed tree -L 2 # Limit depth to 2 levels starmap embed tree -s catalog # Show file sizes`, Args: cobra.MaximumNArgs(1), RunE: func(_ *cobra.Command, args []string) error { targetPath := "." if len(args) > 0 { targetPath = embedutil.NormalizePath(args[0]) } fsys := embedutil.GetEmbeddedFS() return showTree(fsys, targetPath) }, }
TreeCmd represents the tree command for inspecting embedded filesystem.
Functions ¶
func DetectFileType ¶
DetectFileType returns a simple file type based on extension.
Types ¶
Click to show internal directories.
Click to hide internal directories.