tree

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GitFiles

func GitFiles(dir string) ([]string, error)

GitFiles は指定ディレクトリで git ls-files を実行してファイルリストを返す --cached: 追跡済みファイル、--others: 未追跡ファイル(gitignore含む) ネストされた Git リポジトリ(直下のサブディレクトリに .git がある場合)も探索する

Types

type BuildOptions

type BuildOptions struct {
	Include  []string // 包含パターン(空なら全ファイル)
	Exclude  []string // 除外パターン
	SortDesc bool     // true なら同一種別内を降順に並べる
}

BuildOptions はツリー構築のオプション

type TreeItem

type TreeItem struct {
	Name         string      `json:"name"`
	Path         string      `json:"path"`
	IsDir        bool        `json:"isDir"`
	Children     []*TreeItem `json:"children,omitempty"`
	Worktrees    []string    `json:"worktrees,omitempty"`
	ModifiedAtMs int64       `json:"modifiedAtMs,omitempty"`
	Size         int64       `json:"size,omitempty"`
}

TreeItem はツリーに表示される項目を表す

func BuildFromGitFiles

func BuildFromGitFiles(rootName string, files []string, opts BuildOptions) *TreeItem

BuildFromGitFiles は git ls-files の結果からツリーを構築する

func MergeTreeItemsWithOptions

func MergeTreeItemsWithOptions(base *TreeItem, other *TreeItem, otherWorktree string, opts BuildOptions) *TreeItem

MergeTreeItemsWithOptions は2つのツリーを統合(ユニオン)し、指定された並び順で整列する。

Jump to

Keyboard shortcuts

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