where

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package where provides the "where" command, which prints the absolute path of the discovered .np/ directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmd

func NewCmd(f *cmdutil.Factory) *cli.Command

NewCmd constructs the "where" command which prints the path of the .np/ directory discovered by walking up from the current working directory. Useful for scripting and debugging.

func Run

func Run(ctx context.Context, input RunInput) error

Run executes the where workflow: discovers the .np/ directory, optionally resolves the issue prefix, and prints both. When the prefix is unavailable (PrefixFunc is nil or returns an error), the command succeeds and simply omits the prefix from the output.

Types

type RunInput

type RunInput struct {
	// DiscoverFunc locates the database file, returning its absolute path.
	// In production this is Factory.DatabasePath (workspace-aware); tests
	// provide a stub.
	DiscoverFunc func() (string, error)

	// PrefixFunc returns the database's configured issue ID prefix. When nil
	// or when the function returns an error, the prefix is treated as
	// unavailable and silently omitted from the output. The command still
	// succeeds in that case.
	PrefixFunc func(context.Context) (string, error)

	// JSON enables machine-readable JSON output.
	JSON bool

	// WriteTo receives the output.
	WriteTo io.Writer
}

RunInput holds the parameters for the where command's core logic, decoupled from CLI flag parsing so it can be tested directly. The DiscoverFunc allows tests to inject a stub instead of hitting the real filesystem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL