Function libzettels::examples::generate_examples_with_config
source · [−]Expand description
Takes the path to a directory and creates a directory structure with set of example files and a sample config file inside it.
The result can be represented as follows:
examples
└── Zettelkasten
└── file1.md
└── file2.md
└── file3.md
└── subdir
└── file4.md
└── file5.md
└── onlies
└── markdown-only.md
└── pure-yaml.yaml
└── .hiddendir
└── .hiddenfile2.txt
└── a-file.txt
└── .gitignore
└── .zettelsignore
└── config
└── libzettels.cfg.yaml
This is almost identical to the result of
generate_bare_examples
(see there
for details), except example/config
is no longer empty. It
contains a sample config file in YAML-format, which:
- points to
examples/Zettelkasten
as root dir. - points to
example/config/index.yaml
as index file, which doesn’t exist, yet. - sets the
IndexingMethod
toGrep
. - sets the ignore file to
.gitignore
.
Errors
std::io::Error
of theInvalidInput
kind if the provided path is not a directory or cannot be accessed.- A variety of other
std::io::Error
s for problems with creating and writing to the files in the directory.
Panics
- Panics if the generated
Config
can’t be written to file. This should only happen if something is wrong with the example data. In other words: it shouldn’t happen and is considered a bug.