Documentation
¶
Overview ¶
Package list implements the wherehouse list command for displaying locations and their items in a tree view.
The list command shows items in one or more locations using a tree-style display. Without arguments, it shows all root-level locations. With arguments, it shows only the specified locations.
In non-recursive mode (default), each location shows its direct items and hints for direct child locations (with item and location counts). In recursive mode (--recurse / -r), the full subtree is displayed.
Location arguments that cannot be resolved are rendered inline as "[arg] [not found]" and do not cause a non-zero exit code.
Examples:
wherehouse list wherehouse list Garage wherehouse list -r Garage Office wherehouse list --json Garage
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetListCmd
deprecated
func NewDefaultListCmd ¶
NewDefaultListCmd returns a list command that opens the database from context configuration at runtime. This is the production entry point registered with the root command.
func NewListCmd ¶
NewListCmd returns a list command that uses the provided db for all database operations. The caller retains no reference to db after this call; the returned command's RunE closes it via defer before returning.
Types ¶
type ItemJSON ¶
type ItemJSON struct {
ItemID string `json:"item_id"`
DisplayName string `json:"display_name"`
CanonicalName string `json:"canonical_name"`
InTemporaryUse bool `json:"in_temporary_use"`
}
ItemJSON is the JSON representation of a single item.
type LocationJSON ¶
type LocationJSON struct {
LocationID string `json:"location_id"`
DisplayName string `json:"display_name"`
CanonicalName string `json:"canonical_name"`
FullPathDisplay string `json:"full_path_display"`
IsSystem bool `json:"is_system"`
ItemCount int `json:"item_count"`
LocationCount int `json:"location_count"`
Items []ItemJSON `json:"items"`
Children []LocationJSON `json:"children"`
NotFound bool `json:"not_found,omitempty"`
}
LocationJSON is the JSON representation of a location with its contents.
type LocationNode ¶
type LocationNode struct {
Location *database.Location
Items []*database.Item // direct items (alphabetical)
Children []*LocationNode // sub-locations (alphabetical by display_name)
ChildItemCount int // hint nodes only: item count for this location
ChildLocationCount int // hint nodes only: direct child location count
NotFound bool // true if this node represents an unresolved arg
InputArg string // original input argument, used when NotFound=true
}
LocationNode is one node in the rendered tree.
In non-recursive mode, Children are populated with hint-only nodes (Items and Children are nil; ChildItemCount and ChildLocationCount are set). In recursive mode, Items and Children are fully populated; ChildItemCount and ChildLocationCount are unused (derive from len).
type OutputJSON ¶
type OutputJSON struct {
Locations []LocationJSON `json:"locations"`
}
OutputJSON is the top-level JSON output structure.