Simple text preprocessor for content segmentation.
cargo install --git https://github.com/x0k/mk.git
nix profile install github:x0k/mk
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.
- Content can be specified via std in or input files.
- By default, input file names should begin with
Mkfile
ormkfile
. - Files are read in lexicographic order.
- The contents of the files are concatenated.
- By default, a temporary file will be created and executed.
- If you pipe the program to something then the std out will be used.
/
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
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
Note
Completions ignore the input
argument.
Source completions with bash
:
echo "source <(COMPLETE=bash mk)" >> ~/.bashrc
For other shells see: clap_complete
MIT