cmd

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDestinationExists = errors.New("destination already exists")

ErrDestinationExists is returned when the destination file already exists during --move-to.

View Source
var ErrMutuallyExclusive = errors.New("--move-to and --in-place cannot be used together")

ErrMutuallyExclusive is returned when --in-place and --move-to are both set.

Functions

func BuildHTTPMux added in v0.8.0

func BuildHTTPMux(pbURL, token, graphPath string) *http.ServeMux

BuildHTTPMux creates the HTTP mux with all routes registered.

func DashboardAliases added in v0.8.0

func DashboardAliases() []string

DashboardAliases returns the Cobra aliases for the dashboard command. Exported so tests can verify the alias without accessing the unexported global.

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func NewGroomCmd added in v0.8.0

func NewGroomCmd(deps *GroomDependencies) *cobra.Command

NewGroomCmd creates a new groom command with the specified dependencies. If deps is nil, it uses default (production) implementations.

func NewMdCmd added in v0.6.1

func NewMdCmd(deps *MdDependencies) *cobra.Command

NewMdCmd creates a new md command with the specified dependencies. If deps is nil, it uses default implementations.

func NewOutlineCmd added in v0.8.0

func NewOutlineCmd(deps *OutlineDependencies) *cobra.Command

NewOutlineCmd creates the outline command with injectable dependencies. If deps is nil, production defaults are used. Individual nil fields also fall back to their defaults, so tests can inject only the fields they need.

func NewSyncCmd added in v0.8.0

func NewSyncCmd(deps *SyncDependencies) *cobra.Command

NewSyncCmd creates a new sync command with the specified dependencies. If deps is nil, it uses default (production) implementations.

func NewTaskAddCmd added in v0.6.1

func NewTaskAddCmd(deps *TaskAddDependencies) *cobra.Command

NewTaskAddCmd creates a new task add subcommand with the specified dependencies. If deps is nil, it uses default implementations.

func NewTaskCmd added in v0.6.1

func NewTaskCmd() *cobra.Command

NewTaskCmd creates the parent task command.

func NewTaskLsCmd added in v0.8.0

func NewTaskLsCmd(deps *TaskLsDependencies) *cobra.Command

NewTaskLsCmd creates a new task ls subcommand with the specified dependencies. If deps is nil, it uses default implementations. Individual nil fields also fall back to their defaults, so a test can inject only LogseqAPI + Out and leave GraphName defaulted.

func ParseDateFromJournalFlag added in v0.6.1

func ParseDateFromJournalFlag(journalFlag string, timeNow func() time.Time) (time.Time, error)

ParseDateFromJournalFlag parses the journal flag and returns the target date. If journalFlag is empty, it returns the current time from timeNow. If journalFlag is not empty, it parses it as YYYY-MM-DD format. Returns an error if the date format is invalid.

func ResolveEnvWithDefault added in v0.8.0

func ResolveEnvWithDefault(key, fallback string) string

ResolveEnvWithDefault returns the env var value or fallback if unset.

func ResolvePort added in v0.8.0

func ResolvePort(cmd *cobra.Command) int

ResolvePort returns the effective port: flag > env var > default.

Types

type GroomDependencies added in v0.8.0

type GroomDependencies struct {
	TimeNow func() time.Time
}

GroomDependencies holds all injectable dependencies for the groom command. This enables unit testing without connecting to PocketBase, Logseq, or a terminal.

type MdDependencies added in v0.6.1

type MdDependencies struct {
	InsertFn  func(*internal.InsertMarkdownOptions) error
	OpenGraph func(string) *logseq.Graph
	ReadStdin func() string
	TimeNow   func() time.Time
}

MdDependencies holds all the dependencies for the md command.

type OutlineDependencies added in v0.8.0

type OutlineDependencies struct {
	Convert   func(input string, opts internal.OutlineOptions) string
	ReadFile  func(path string) (string, error)
	WriteFile func(path string, data string) error
	Stat      func(path string) (os.FileInfo, error)
	Rename    func(oldpath, newpath string) error
	Remove    func(path string) error
	Stdin     func() string
	Out       io.Writer
}

OutlineDependencies holds injectable dependencies for the outline command.

type SyncDependencies added in v0.8.0

type SyncDependencies struct {
	TimeNow func() time.Time
}

SyncDependencies holds all injectable dependencies for the sync command. This enables unit testing without connecting to PocketBase or Logseq.

type TaskAddDependencies added in v0.6.1

type TaskAddDependencies struct {
	AddTaskFn func(*logseqext.AddTaskOptions) error
	OpenGraph func(string) *logseq.Graph
	TimeNow   func() time.Time
}

TaskAddDependencies holds all the dependencies for the task add command.

type TaskLsDependencies added in v0.8.0

type TaskLsDependencies struct {
	NewAPI    func() api.LogseqAPI
	GraphName func() string
	Out       io.Writer
}

TaskLsDependencies holds all the dependencies for the task ls command.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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