Skip to content

Latest commit

 

History

History
125 lines (81 loc) · 3.56 KB

README.md

File metadata and controls

125 lines (81 loc) · 3.56 KB

Dotfiles Demo

A Dotfiles Demo

A functional demo of markdown-managed dotfiles.

- `.env` (optional) set key-value pairs for replacement
- `**/*.md` dotfiles stored as markdown

Usage

npx dotfiles-md --demo

screenshot

The dotfiles blocks

tip: View the raw markdown file to see the metadata on each codeblock

A codeblock without an action=* annotation does nothing and won't appear in the CLI

_sometimes you don't want to run a code block_

Replacements from .env content

All blocks support replacements when they're read from your own .env file

// source: demo/README.md using demo/.env

console.log("hello world", "%S3_BUCKET");

Demo: Build Actions

# Build

The basic build action converts a block of code into a file.

screenshot

> source: `dotfiles-md-hello-symlink.md` https://www.npmjs.com/package/dotfiles-md?activeTab=code

# Hello World!

This built dotfile comes from the `action=build example.md` file of the library.

With action=build, files are built directly to the location specified in the code block's metadata.

Demo: Run Actions

# Run

The action=run flag executes the codeblock with an interpreter appropriate to the syntax of the code block. These code blocks do not use the filePath metadata.

for an up-to-date list of available interpreters, consult the API.ts codebase.

screenshot of executing run actions

Bash

echo "Hello BASH";

Node

console.log("Hello NODE!");

Shell

echo "Hello SHELL"

ZSH

echo "Hello SHELL"

Demo: Symlink Actions

# Symlink

The action=symlink file will creates a file in /build/{timestamp}/ for the code block and creates a symlink at the specified specified location.

You can use $HOME to refer to the home directory as in $HOME/.gitconfig for your global git config.

screenshot of running this example

Hello World Symlink (outputs hello-symlink.md where it was run)

> source: `demo/README.md` https://www.npmjs.com/package/dotfiles-md?activeTab=code

# Hello Symlink!

As a result of action=symlink, the contents of this file lives in a build directory (relative to where you ran `dotfiles-md`), and a symlink was created in the specified location.

Home Directory Hello Symlink (outputs ~/dotfiles-md-hello-symlink.md)

This example creates a file in your home directory ~/dotfiles-md-hello-symlink.md symlinked to ./build/{timestamp}/{#}-dotfiles-md-hello-symlink.md (the file counter is used to dedupe potential naming conflicts).

> source: `demo/README.md` https://www.npmjs.com/package/dotfiles-md?activeTab=code

# Hello Symlink – Home Directory!

As a result of action=symlink, the contents of this file lives in a build directory (relative to where you ran `dotfiles-md`), and a symlink was created in the specified location (`$HOME/dotfiles-md-hello-symlink.md`).