Skip to content
/ mk Public

Text preprocessor for content segmentation.

License

Notifications You must be signed in to change notification settings

x0k/mk

Repository files navigation

mk

Simple text preprocessor for content segmentation.

Installation

With cargo

cargo install --git https://github.com/x0k/mk.git

With nix profile

nix profile install github:x0k/mk

Syntax

mkfile content:

common content

foo:
    foo segment start

# segment with a dependency
bar: foo
    bar segment content

# multiple segment definition
foo:
    foo segment end

$ mk bar | cat output:

common content

foo segment start

# segment with a dependency
bar segment content

# multiple segment definition
foo segment end

That's all.

Input

  • Content can be specified via std in or input files.
  • By default, input file names should begin with Mkfile or mkfile.
  • Files are read in lexicographic order.
  • The contents of the files are concatenated.

Output

  • By default, a temporary file will be created and executed.
  • If you pipe the program to something then the std out will be used.

Syntax sugar

Groups

  • / at the end of the segment name defines a group.
  • / at the beginning of the dependency name indicates that name should be left as is.
foo:
    foo content

group/:
    pushd folder
    
    bar: /foo
        bar segment content
    
    baz: bar
        baz segment content
    
    popd

Desugared:

foo:
    foo content

group:
    pushd folder

group/bar: foo group
    bar segment content

group/baz: group/bar group
    baz segment content

group:
    popd

Glob pattern in dependencies list

l/lib1/build:
    build lib1

l/lib2/build:
    build lib2

app: l/*/build
    build app

Desugared:

l/lib1/build:
    build lib1

l/lib2/build:
    build lib2

app: l/lib1/build l/lib2/build
    build app

Completions

Note

Completions ignore the input argument.

Source completions with bash:

echo "source <(COMPLETE=bash mk)" >> ~/.bashrc

For other shells see: clap_complete

License

MIT

About

Text preprocessor for content segmentation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published