Documentation
¶
Index ¶
- Variables
- func BuildHTTPMux(pbURL, token, graphPath string) *http.ServeMux
- func DashboardAliases() []string
- func Execute()
- func NewGroomCmd(deps *GroomDependencies) *cobra.Command
- func NewMdCmd(deps *MdDependencies) *cobra.Command
- func NewOutlineCmd(deps *OutlineDependencies) *cobra.Command
- func NewSyncCmd(deps *SyncDependencies) *cobra.Command
- func NewTaskAddCmd(deps *TaskAddDependencies) *cobra.Command
- func NewTaskCmd() *cobra.Command
- func NewTaskLsCmd(deps *TaskLsDependencies) *cobra.Command
- func ParseDateFromJournalFlag(journalFlag string, timeNow func() time.Time) (time.Time, error)
- func ResolveEnvWithDefault(key, fallback string) string
- func ResolvePort(cmd *cobra.Command) int
- type GroomDependencies
- type MdDependencies
- type OutlineDependencies
- type SyncDependencies
- type TaskAddDependencies
- type TaskLsDependencies
Constants ¶
This section is empty.
Variables ¶
var ErrDestinationExists = errors.New("destination already exists")
ErrDestinationExists is returned when the destination file already exists during --move-to.
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
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
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
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
ResolveEnvWithDefault returns the env var value or fallback if unset.
func ResolvePort ¶ added in v0.8.0
ResolvePort returns the effective port: flag > env var > default.
Types ¶
type GroomDependencies ¶ added in v0.8.0
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
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.