cmd

package
v0.0.0-...-4b60cfd Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute() error

Execute runs the root command.

func NewDictateCommand

func NewDictateCommand(deps DictateDeps) *cobra.Command

NewDictateCommand creates a new dictate command for voice-to-text diary entry.

func NewEditV2Command

func NewEditV2Command(store storage.StorageV2) *cobra.Command

NewEditV2Command creates a new edit command for the v2 data model. The command opens an editor for creating new diary blocks with optional template support and custom attributes.

Flags:

  • --template: Template name to use (renders with --var flags)
  • --var: Template variables in KEY=value format (repeatable)
  • --attr: Block attributes in key=value format (repeatable)
  • --date: Target date for the block (YYYY-MM-DD format, default: today)

Template Behavior:

  • If --template is provided, the template is loaded and rendered with vars
  • Template attributes are merged into block attributes (user attrs override)
  • The rendered content is used as initial editor content

Editor Behavior:

  • Opens the user's configured editor with initial content
  • If content is empty after editing, the command aborts
  • Otherwise, creates a block with the edited content

The command:

  • Generates a block ID using block.NewID()
  • Sets CreatedAt and UpdatedAt to the current timestamp
  • Creates the block in storage
  • Prints "Created block {id} on {date}"

func NewJotV2Command

func NewJotV2Command(store storage.StorageV2) *cobra.Command

NewJotV2Command creates a new jot command for the v2 data model. The command accepts content as arguments (joined with spaces) and creates a new block in the storage backend.

Flags:

  • --date: Specify the date for the block (YYYY-MM-DD format, default: today)
  • --attr: Add attributes to the block (key=value format, repeatable)

The command:

  • Generates a block ID using block.NewID()
  • Sets CreatedAt and UpdatedAt to the current timestamp
  • Creates the block in storage
  • Prints "Created block {id} on {date}"

func NewRootV2Command

func NewRootV2Command(store storage.StorageV2) *cobra.Command

NewRootV2Command creates a root command for the v2 data model. This is a helper function for testing and programmatic usage of the CLI with the StorageV2 interface.

Parameters:

  • store: A StorageV2 implementation to use for all operations

Returns:

  • A configured cobra.Command with all v2 subcommands attached

Types

type DictateDeps

type DictateDeps struct {
	Store       storage.StorageV2
	Recorder    audio.Recorder         // nil = resolve from config at runtime
	Transcriber transcribe.Transcriber // nil = resolve from config at runtime
	Editor      string                 // editor command (empty = resolve from config)
	Theme       ui.Theme               // TUI theme

	// Config fields used for runtime resolution when Recorder/Transcriber are nil.
	RecorderName string            // config recorder name for audio.ResolveRecorder
	Engine       string            // config engine name (e.g. "whisper", "parakeet", "command")
	EngineConfig transcribe.Config // config for creating a transcriber
}

DictateDeps holds dependencies for the dictate command, allowing injection of mock implementations in tests.

Jump to

Keyboard shortcuts

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