cli/pkg/help
Snider 41a0faba75 refactor: migrate module path from Snider/Core to host-uk/core
Move Go module from github.com/Snider/Core to github.com/host-uk/core
to match the new repository location under the host-uk organization.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 15:29:42 +00:00
..
.github refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
assets/stylesheets refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
examples refactor: migrate module path from Snider/Core to host-uk/core 2026-01-28 15:29:42 +00:00
public refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
src refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
ui refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
.gitignore refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
.goreleaser.yaml refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
go.mod refactor: migrate module path from Snider/Core to host-uk/core 2026-01-28 15:29:42 +00:00
go.sum refactor: migrate module path from Snider/Core to host-uk/core 2026-01-28 15:29:42 +00:00
help.go refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
help_test.go refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
LICENSE refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
mkdocs.yml refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
README.md refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
requirements.txt refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00
taskfile.dist.yml refactor: bring external packages home and restructure 2026-01-15 15:30:43 +00:00

Help Module

Go Reference Go Report Card Codecov Build Status License: EUPL-1.2

This repository contains the help module, which was formerly part of the Snider/Core framework. This module provides assistance and documentation functionality.

Getting Started

This project uses mkdocs-material to build the documentation. To get started, you will need to have Python and pip installed.

  1. Install the dependencies:

    pip install -r requirements.txt
    
  2. Run the development server:

    mkdocs serve
    

Usage

To use the help module, you first need to import it in your Go project:

import "github.com/Snider/help"

Next, initialize the help service by calling the New function. The New function accepts an Options struct, which allows you to configure the documentation source.

Using a custom embed.FS

You can provide your own embed.FS as a documentation source. This is useful when you want to bundle the documentation with your application.

import (
    "embed"
    "github.com/Snider/help"
)

//go:embed all:my-docs/build
var myDocs embed.FS

func main() {
    helpService, err := help.New(help.Options{
        Assets: myDocs,
    })
    if err != nil {
        // Handle error
    }
    // ...
}

Custom Static Site Source

You can also provide a custom directory containing a static website as the documentation source. To do this, set the Source field in the Options struct to the path of your static site directory:

helpService, err := help.New(help.Options{
    Source: "path/to/your/static/site",
})
if err != nil {
    // Handle error
}

Once the help service is initialized, you can use the Show() and ShowAt() methods to display the documentation.

Displaying Help

The Show() method opens the help window to the main page.

err := helpService.Show()
if err != nil {
    // Handle error
}

The ShowAt() method opens the help window to a specific anchor. The provided anchor is normalized into a URL. For example, calling ShowAt("ui/how/settings#resetPassword") will open the help window to a URL similar to http://localhost:8080/docs/ui/how/settings/index.html#resetPassword. The exact URL depends on how your display service resolves these paths.

err := helpService.ShowAt("ui/how/settings#resetPassword")
if err != nil {
    // Handle error
}