Skip to content

Add lnk create command for empty files and directories - #29

Merged
polymorcodeus merged 3 commits into
mainfrom
create
Aug 30, 2026
Merged

Add lnk create command for empty files and directories#29
polymorcodeus merged 3 commits into
mainfrom
create

Conversation

@polymorcodeus

@polymorcodeuspolymorcodeus commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

Adds lnk create, a shortcut for creating empty files or directories and immediately tracking them in the lnk repo. This removes the need to create files manually before running lnk add.

What's new

  • New lnk create command - creates empty files or directories and tracks them in one step.
  • Directory placeholder - empty directories are created with a .lnkkeep file so git tracks them.
  • Dual directory syntax - directories can be requested with --dir or a trailing path separator.
  • Host scope support - works with --host for per-machine creation.

Usage

CommandPurpose
create <path...>Create empty files and track them
create --dir <path...>Create empty directories and track them
create <dir>/Same as --dir using trailing slash
create --host <host> <path...>Create and track in a host scope

Behavior changes / guardrails

  • Invocations must be homogeneous; mixing files and directories in one command errors.
  • Existing files and non-empty directories are rejected with a suggestion to use lnk add.
  • Targets inside git repos, inside already-managed directories, or already tracked paths are rejected.
  • service/create.go adds CreateOptions and a .lnkkeep helper; internal/lnkerror gains ErrPathExists and ErrMixedCreateTypes.

Testing

  • Unit tests in service/create_test.go and cmd/create_test.go cover file creation, directory creation, host scope, v1 format, guardrails, and CLI argument validation.
  • README and AGENTS updated to document the new command.
  • make check runs fmt, vet, lint, unit, and integration suites; all green.

Closes#7

@polymorcodeuspolymorcodeus self-assigned this Aug 30, 2026
@polymorcodeus
polymorcodeus merged commit fb931df into mainAug 30, 2026
4 checks passed
@polymorcodeus
polymorcodeus deleted the create branch August 30, 2026 01:29
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add lnk create to create empty file or directory already added and tracked

1 participant

@polymorcodeus